9618/23/M/J/25 question 6: worked solution (May/June 2025, paper 23)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 12.2 Program Design Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3. Q29 9618/23/M/J/25 original Q6 Structured · 9 marks Worked solution (a) 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. (b) 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] (c) 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] KEY IDEA In a structure chart a diamond means selection, a curved arrow means repetition, and arrows with circles show the parameters and return values that make up each module header. TOTAL 9 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Awab Aqib. Tap the picture to open it on YouTube.