Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3.
Write what the curved arrow shows, using the module names:
It shows repetition (iteration) [1]
Convert repeatedly calls Analyse, then Update, then Sort, in that order [1]
Count goes into Analyse and does not come back, so it is a procedure. Update takes Key (STRING) and gives back T1 (the number of elements, so INTEGER), so it is a function. P2 has a filled circle (a flag, so BOOLEAN) and goes both ways, so it is passed by reference.
PROCEDURE Analyse(Count : INTEGER) FUNCTION Update(Key : STRING) RETURNS INTEGER PROCEDURE Sort(BYREF P2 : BOOLEAN)
Analyse as a PROCEDURE with parameter Count : INTEGER [1]
Update as a FUNCTION with parameter Key : STRING [1]
Update RETURNS INTEGER [1]
Sort as a PROCEDURE with BYREF P2 : BOOLEAN [1]
▶ 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.