Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 8 of 8.
Set Higher to 0 before the loop, test each number as it is input, and output Higher once after the loop.
Higher ← 0
FOR Count ← 1 TO 5000
INPUT Number[Count]
IF Number[Count] > 500
THEN
Higher ← Higher + 1
ENDIF
NEXT Count
OUTPUT "There are ", Higher, " values that are greater than 500"Higher set to 0 before the loop [1]
An IF statement used [1]
Correct condition in the IF (Number[Count] > 500) [1]
Correct counting statement inside the loop [1]
OUTPUT with a correct reference to Higher, after the loop [1]
An appropriate message in the output [1]
▶ Whole paper
Video solution of the whole paper · by Quixotic Academy. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.