Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software

Q29 · 9618/31/O/N/24 Q10

Worked solution from the System Software Paper 3 Advanced Theory booklet, Part 2 of 2.

Q299618/31/O/N/24original Q10Structured · 9 marks
Question 10 from 9618/31/O/N/24

Worked solution

(a)

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]

(b)(i)

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]

(b)(ii)

<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.

KEY IDEABNF lists alternatives with | and sequences by writing items side by side; an optional item needs two alternatives.
TOTAL 9 marks

Official mark scheme

Mark scheme for 9618/31/O/N/24 question 10
VIDEO
▶ 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.