9618/22/O/N/23 question 7: worked solution (October/November 2023, paper 22)

Show as 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. Q21 9618/22/O/N/23 original Q7 Structured · 6 marks 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 IDEA A diamond on a structure chart means selection: only one of the modules below it is called each time. TOTAL 6 marks Official mark scheme VIDEO ▶ Starts at Q7 (40:48) Starts at Q7 (40:48) · by Pseudocode Pro. Tap the picture to open it on YouTube.