Worked solution from the Data Types and Structures Paper 2 Problem-solving and Programming booklet, Part 2 of 4.
Draw the flowchart in this order. The first loop reads the values and the second loop outputs them backwards.
START → box: SET Count TO 1 → decision: IS Count = 101 ?
Index (Count) set to 1 (or 0) before the first loop [1]
Loop that runs 100 times (decision Count = 101, with NO going round the loop) [1]
On NO: parallelogram INPUT Value [1]
Then box SET Number[Count] TO Value, then box Increment Count, then back to the decision [1]
On YES: box SET Count TO 100, then decision IS Count = 0 ? so the output loop starts at the last element [1]
On NO: parallelogram OUTPUT Number[Count], then box Decrement Count, then back to the decision; on YES go to END, so every element is output once in reverse order [1]
▶ Whole paper
Video solution of the whole paper · by Awab Aqib. 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.