Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3.
Write one difference (either scores):
A function returns a (single) value but a procedure does not [1]
Or: a procedure can pass parameters by reference (BYREF). Only one point is needed.
Read each module on the chart. An arrow with an open circle is data passed in. An arrow with a filled circle is a flag. The data types are given in the question.
Sub_Part1A takes only R (INTEGER) and returns nothing, so it is a procedure:
PROCEDURE Sub_Part1A(R : INTEGER)
PROCEDURE with its name and parameter R : INTEGER [1]
Sub_Part2A takes T (REAL) and returns a flag (BOOLEAN), so it is a function:
FUNCTION Sub_Part2A(T : REAL) RETURNS BOOLEAN
FUNCTION with parameter T : REAL [1]
RETURNS BOOLEAN [1]
Sub_Part3A takes V (INTEGER), W (BOOLEAN) and U (STRING) which goes in and comes back out, so U is passed by reference:
PROCEDURE Sub_Part3A(V : INTEGER, W : BOOLEAN, BYREF U : STRING)
PROCEDURE with parameters V : INTEGER and W : BOOLEAN [1]
BYREF U : STRING [1]
Write what each symbol means, using the module names:
Diamond: selection, so Main calls either Sub_A or Sub_B (decided when the program runs) [1]
Curved arrow: repetition (iteration), so Sub_A repeatedly calls Sub_Part1A, then Sub_Part2A, then Sub_Part3A [1]
Both explanations use the correct module names [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.