Cambridge AS Level Computer Science 9618 · 12.2 Program Design

Q21 · 9618/22/O/N/23 Q7

Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3.

Q219618/22/O/N/23original Q7Structured · 6 marks
Question 7 from 9618/22/O/N/23

Worked solution

(a)

Module-A() calls Module-X(), Module-Z() or Module-Y(). Module-X() calls Reset() and Module-Y() calls Restore(). Fill the boxes, then add the arrows (open circle = data, filled circle = flag).

Names in the boxes: Module-X, Module-Z, Module-Y with Reset below Module-X and Restore below Module-Y [1]

Module-X: arrows down labelled T1 and S2. Between Module-X and Reset: Code going down and back up (BYREF) [1]

Module-Z: SA going down and the integer returned going up [1]

Module-Y: RA and RB going down and a Boolean returned up. Restore: OldCode going down and a Boolean returned up [1]

(b)

The diamond is the symbol for a choice.

It shows selection: Module-A() calls one of the modules, decided while the program runs [1]

Name all four modules: Module-A calls one of Module-X, Module-Y or Module-Z [1]

KEY IDEAA diamond on a structure chart means selection: only one of the modules below it is called each time.
TOTAL 6 marks

Official mark scheme

Mark scheme for 9618/22/O/N/23 question 7
VIDEO
▶ Starts at Q7 (40:48)

Starts at Q7 (40:48) · 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.