9618/21/M/J/22 question 2: worked solution (May/June 2022, paper 21)
Show as plain textHide 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. Q13 9618/21/M/J/22 original Q2 Structured · 7 marks 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 inputs 3 The number of different outputs 3 The single input value that could result in S4 Button-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. Input Output Next state Button-Y none S3 Button-Y none S4 Button-Z Output-B S2 Button-Z none S1 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 IDEA Read 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 VIDEO ▶ Whole paper Video solution of the whole paper · by CS BY AQIB KHAN. Tap the picture to open it on YouTube.