Worked solution from the System Software Paper 3 Advanced Theory booklet, Part 2 of 2.
Read each diagram and write it in BNF.
<operator> ::= + | – | * | / <label> ::= <letter><digit> | <letter><digit><digit> <equation> ::= <label> = <label><operator><label>
<operator> correct: any of the four symbols [1]
<label> is a letter, then a digit, then an optional second digit [1]
<equation> first part: <label> = [1]
<equation> second part: <label><operator><label> [1]
Draw the diagram in this order: start, then a choice of letter or symbol, then digit, then symbol with a loop-back route so that a second symbol is allowed, then the end. Label it password.
Starts with a choice of letter or symbol [1]
Ends with one or two symbols (a bypass or loop) [1]
Digit in the middle, all connections and the label correct [1]
<password> ::= <letter><digit><symbol> | <letter><digit><symbol><symbol> | <symbol><digit><symbol> | <symbol><digit><symbol><symbol>
First alternative <password> ::= <letter><digit><symbol> correct [1]
The other three alternatives correct [1]
A shorter way also scores: write <first> ::= <letter>|<symbol>, <last> ::= <symbol>|<symbol><symbol> and <password> ::= <first><digit><last>. All three lines correct scores 2 marks; any two lines correct scores 1 mark.
▶ Topic lesson
A lesson on this topic · by Craig'n'Dave. 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.