Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software

Q37 · 9618/33/M/J/25 Q9

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

Q379618/33/M/J/25original Q9Structured · 6 marks
Question 9 from 9618/33/M/J/25

Worked solution

(a)

JJ90: the second character is J, which is an upper. The second character must be a lower or a digit [1]

(b)

The second and third characters are each a lower or a digit. Write:

<upper> ::= J | K | L | V | X | Z [1]

<passcode> ::= <upper><lower><lower><digit> |
    <upper><lower><digit><digit> |
    <upper><digit><lower><digit> |
    <upper><digit><digit><digit>

Any two correct options for <passcode> [1]

The other two options correct [1]

Another correct way: <passcode> ::= <upper><middle><middle><digit> with <middle> ::= <lower> | <digit>. This earns the same two marks.

(c)

In the diagram, add an upper box as a third choice in the box for the third character, with its own entry and exit lines. Then add a loop line from after the final digit back to just before it, so the final digit can repeat.

upper box in the correct place with correct connections [1]

Correct repetition arrow round the final digit [1]

KEY IDEAEach choice in a syntax diagram is an alternative in BNF, and a loop means the part can repeat.
TOTAL 6 marks

Official mark scheme

Mark scheme for 9618/33/M/J/25 question 9
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.