Worked solution from the Algorithm Design and Problem-solving Paper 2 Problem-solving and Programming booklet, Part 2 of 2.
Draw a loop that inputs a value, stops on 99.9 or when the array is full:
START → Set Index to 1 → Input Num → decision "Is Num = 99.9?"
If YES: END. If NO: Set Data[Index] to Num → Set Index to Index + 1 → decision "Is Index = 21?" If YES: END. If NO: back to Input Num.
Array index set to 1 before the loop [1]
Input a number inside the loop [1]
Test for 99.9 with correct ending, before it is stored [1]
Test for the array full (Index = 21, or 20 repeats) with correct ending [1]
Assign the number to Data[Index] and increase the index [1]
One decision "Num = 99.9 or Index = 21" placed straight after the input is also accepted.
▶ Whole paper
Video solution of the whole paper · by MAK CS. 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.