A smart sensor records the water level variations of a river relative to its baseline (in centimeters) every hour over an 8-hour monitoring window.
The algorithm in Figure 1 has been created to count and output how many times the river level exceeded a specific threshold.
Figure 1
SET levels TO [12, -4, 0, 8, -2, 15, 30, -1]
SET warning_count TO 0
SET index TO 0
WHILE index < LENGTH(levels) DO
IF levels[index] > 10 THEN
SET warning_count TO warning_count + 1
END IF
SET index TO index + 1
END WHILE
SEND "High levels recorded: " & warning_count TO DISPLAY
Identify the type of iteration construct used in Figure 1.
Post-conditioned loop
Count-controlled loop
Infinite loop
Pre-conditioned loop