Cambridge AS Level Computer Science 9618 · 12.2 Program Design

Q32 · 9618/23/O/N/25 Q7

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

Q329618/23/O/N/25original Q7Structured · 9 marks
Question 7 from 9618/23/O/N/25

Worked solution

(a)

Draw one arrow for each row of the table, labelled input | output (no output means only the input).

FromLabelTo
S1A1S2
S2A2 \X4S3
S3A1 \X1S3 (loop)
S3A2 \X1S3 (loop)
S3A3 \X3S4
S3A4S2
S4A3 \X4S5
S4A4 \X4S5
S4A1S2

The state S5 drawn and labelled [1]

Label A1 added to the arrow from S1 to S2 [1]

Arrows between S2 and S3 in both directions, labelled A2 | X4 (S2 to S3) and A4 (S3 to S2) [1]

Arrows from S3: the loop labelled A1 | X1 and A2 | X1, and S3 to S4 labelled A3 | X3 [1]

Arrows from S4 to S5 (A3 | X4 and A4 | X4) and from S4 to S2 (A1) [1]

Extra events or lines not in the table lose marks (only 4 marks possible if there are any).

(b)

Setup chooses between two modules, so draw a diamond. Restart repeats two modules, so draw a curved arrow.

Boxes for Setup at the top, Restart and Confirm below it, and Update and Modify below Restart, all joined correctly [1]

BYREF string parameter to Restart (arrow both ways), string parameter to Confirm and the integer return from Confirm [1]

Diamond under Setup and the curved (loop) arrow under Restart [1]

String parameter to Update, and the Boolean return value from Modify [1]

KEY IDEAShow selection with a diamond and repetition with a curved arrow, and label every parameter and return value on its arrow.
TOTAL 9 marks

Official mark scheme

Mark scheme for 9618/23/O/N/25 question 7
VIDEO
▶ Topic lesson

A lesson on this topic · by ZAINEMATICS. 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.