Worked solution from the Algorithm Design and Problem-solving Paper 2 Problem-solving and Programming booklet, Part 2 of 2.
Draw the flowchart from START, using these shapes in order:
Process box: set Total to 0 (and a flag or similar to show 27 has not been seen) [1]
Input parallelogram: INPUT a number, then a decision diamond: is the number 27? If No, go back to the input. Only the first 27 switches summing on [1]
After 27 is found, a loop that keeps going until 0 is input: INPUT Number, then decision: is Number = 0? [1]
If No, a process box: Total ← Total + Number, then loop back to the input [1]
If Yes (0 input), output parallelogram: OUTPUT Total, then END [1]
Name: a conditional loop (a pre-condition WHILE loop or a post-condition REPEAT loop) [1]
Justification: the number of iterations is not known in advance, because the loop only stops when 0 is input [1]
▶ Starts at Q2 (8:53)
Starts at Q2 (8:53) · by Pseudocode Pro. 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.