Cambridge AS Level Computer Science 9618 · 12.2 Program Design

Q30 · 9618/21/O/N/25 Q7

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

Q309618/21/O/N/25original Q7Structured · 10 marks
Question 7 from 9618/21/O/N/25

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.

FromLabelTo
S1A2 \X2S3
S1A1 \X1S2
S2A4 \X4S5
S3A1S3 (loop)
S3A3 \X3S2
S3A2 \X4S4
S4A1 \X1S4 (loop)
S4A3S2
S4A4 \X4S5

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 IDEADraw 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

Mark scheme for 9618/21/O/N/25 question 7
VIDEO
▶ 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.