Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3.
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]
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]
▶ Whole paper
Video solution of the whole paper · by CSFeedbySirNisarAli. 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.