Six original Cambridge-style questions on state-transition diagrams, with mark-scheme style solutions.
State the purpose of a state-transition diagram.
Using Fig. 1 of the lesson (the car alarm), give the state after each input and any output, for the inputs: lock, door opened, unlock, door opened.
A lamp has states Off, Dim and Bright. It starts Off. Pressing the button moves Off to Dim, Dim to Bright and Bright to Off. Holding the button for 3 seconds in any state turns it Off. Complete a state-transition table for the lamp.
Explain how a start state and a halting state are shown on a state-transition diagram.
A turnstile has states Locked and Unlocked, starting Locked. Input coin in Locked moves to Unlocked; input push in Unlocked moves to Locked. Other inputs cause no change. The current state is stored in the global variable State. Write a pseudocode procedure Turnstile(Event : STRING) that makes the transitions.
In Fig. 2 of the lesson, a user wants the keypad to unlock again 10 minutes after it reaches Locked. Describe the change to the diagram.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.