Cambridge AS Level Computer Science 9618 · 12.2 Program Design

Q13 · 9618/21/M/J/22 Q2

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

Q139618/21/M/J/22original Q2Structured · 7 marks
Question 2 from 9618/21/M/J/22

Worked solution

(a)

Count from the diagram. Inputs on the arrows are Button-X, Button-Y and Button-Z. Outputs are Output-A, Output-B and Output-C. Both arrows that enter S4 (from S2 and from S3) use Button-Y, so that is the single input.

Answer
The number of different inputs3
The number of different outputs3
The single input value that could result in S4Button-Y

Inputs: 3 [1]

Outputs: 3 [1]

Input that results in S4: Button-Y [1]

(b)

Follow the diagram from S1: Button-Y goes to S3. Button-Y from S3 goes to S4. Button-Z from S4 goes to S2 with Output-B. Button-Z from S2 goes to S1.

InputOutputNext state
Button-YnoneS3
Button-YnoneS4
Button-ZOutput-BS2
Button-ZnoneS1

Row 1 correct [1]

Row 2 correct [1]

Row 3 correct [1]

Row 4 correct [1]

Other answers that follow valid arrows in the diagram are also accepted.

KEY IDEARead a state-transition diagram by finding the arrow that leaves the current state with the given input, then note its output and the state it enters.
TOTAL 7 marks

Official mark scheme

Mark scheme for 9618/21/M/J/22 question 2
VIDEO
▶ Whole paper

Video solution of the whole paper · by CS BY AQIB KHAN. 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.