Skip to content
MathsGenie logo
Open app

Course home

  1. GCSE
  2. Computer Science Edexcel
  3. Question bank

Computational thinking

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
Question 38

EcoTemp uses automated sensors to monitor greenhouse temperatures.

Programmers are developing an algorithm to detect if any temperature readings exceed 35°C to trigger a ventilation alert. They are testing the algorithm with a small dataset to verify its efficiency before deploying it to handle larger, continuous streams of sensor data.

Here is the pseudo-code for the containment alert algorithm:

1 SET maximum TO LENGTH(temperatures)
2 SET i TO 0
3 SET highTempFound TO FALSE
4
5 WHILE (i < maximum) DO
6     IF (temperatures[i] > 35) THEN
7         SET highTempFound TO TRUE
8     END IF
9     SET i TO i + 1
10 END WHILE
11
12 IF (highTempFound == TRUE) THEN
13     SEND "Warning: High temperature detected!" TO DISPLAY
14 END IF

Here is the test dataset stored in the array temperatures:

21, 23, 39, 22, 20, 24

Describe one inefficiency when executing the algorithm with this dataset.

[2]

Computational thinking Questions

  1. GCSE
  2. /Computer Science
  3. /Computational thinking