A smart home monitoring system uses an algorithm to check the battery levels of various wireless sensors.
1 SET sensors TO ["hallway", "kitchen", "lounge", "bedroom", "garage", "garden"]
2
3 SET battery TO [0.12, 0.45, 0.08, 0.88, 0.02, 0.67]
4
5 SET index TO 0
6
7 WHILE index < 6 DO
8
9 IF (battery[index] < 0.1) THEN
10 SEND (sensors[index] & " low battery warning") TO DISPLAY
11
12 ELSE
13 IF (battery[index] >= 0.4) AND (battery[index] <= 0.6) THEN
14 SEND (sensors[index] & " check status") TO DISPLAY
15 END IF
16 END IF
17
18 SET index TO index + 1
19
20 END WHILE
The algorithm currently works with a fixed number of sensors.
Give the number of the line in the algorithm that would need to be amended to allow the algorithm to work for any number of sensors.
45 exam-style questions on Edexcel IGCSE Computer Science Algorithms. Each one has a worked solution and a mark scheme showing where the marks go.