Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 8 of 8.
Fill in the blank boxes of the flowchart in order:
Input box after Count ← 0: INPUT Score [1]
Decision box: IS Score >= 50? [1]
Yes side, first box: Pass[PassCount] ← Score [1]
No side, first box: Fail[FailCount] ← Score [1]
Yes side, second box: PassCount ← PassCount + 1. No side, second box: FailCount ← FailCount + 1 (both counters increase) [1]
Last decision box: IS Count = 60? (Yes goes to END, No goes back to the input) [1]
Use a loop that keeps asking while the score is not between 0 and 100.
WHILE Score < 0 OR Score > 100 DO
OUTPUT "Your entry must be between 0 and 100, inclusive, please try again"
INPUT Score
ENDWHILEAppropriate conditional loop [1]
Correct test for invalid input (below 0 or above 100) [1]
Suitable error message [1]
Score input again until it is correct [1]
Also accepted: REPEAT with an IF inside and UNTIL Score >= 0 AND Score <= 100.
▶ Topic lesson
A lesson on this topic · by Mr Bulmer's Learning Zone. 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.