9618/21/O/N/25 question 7: worked solution (October/November 2025, paper 21)

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. Q30 9618/21/O/N/25 original Q7 Structured · 10 marks Worked solution (a) Draw one arrow for each row of the table, with the label input | output. A row with no output has only the input. From Label To S1 A2 \ X2 S3 S1 A1 \ X1 S2 S2 A4 \ X4 S5 S3 A1 S3 (loop) S3 A3 \ X3 S2 S3 A2 \ X4 S4 S4 A1 \ X1 S4 (loop) S4 A3 S2 S4 A4 \ X4 S5 Arrow from S1 to S2 labelled A1 | X1 [1] The states S3, S4 and S5 drawn and labelled [1] Arrow from S2 to S5 labelled A4 | X4 [1] Arrows from S3 with correct labels, including the loop on S3 labelled A1 [1] Arrows from S4 with correct labels, including the loop on S4 labelled A1 | X1 [1] (b) Setup repeatedly calls Restart, Modify and Final. Update is called by Modify and Confirm by Final. A filled circle is a flag and an open circle is data. Write each label by its arrow: Boxes labelled Restart, Modify, Final (under Setup) and Update (under Modify), Confirm (under Final) [1] A curved iteration arrow under Setup [1] Parameters H1 and C1 passed down to Restart [1] B1 passed down to Modify, the return value from Modify up to Setup and T1 passed down to Final [1] R2 drawn as a BYREF parameter (arrow both ways) between Modify and Update. Confirm also returns a flag up to Final. [1] KEY IDEA Draw one labelled arrow per table row for a state diagram; on a structure chart show repetition with a curved arrow and every parameter and return value as arrows. TOTAL 10 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by CSFeedbySirNisarAli. Tap the picture to open it on YouTube.