Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software

Q33 · 9618/31/M/J/25 Q7

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

Q339618/31/M/J/25original Q7Structured · 6 marks
Question 7 from 9618/31/M/J/25

Worked solution

(a)

Check each passcode against the passcode diagram: it starts with an uppercase letter, then any number of lowercase letters, symbols or digits.

#Jd7: it begins with a symbol, but it must begin with an uppercase letter [1]

C%6A: the fourth character A is uppercase, but after the first character only lowercase, symbol or digit are allowed [1]

(b)

The loop in the diagram becomes a recursive rule in BNF.

<uppercase> ::= A | C | E | G | J
<passcode> ::= <uppercase><code>
<code> ::= <lowercase> | <symbol> | <digit> |
    <lowercase><code> | <symbol><code> | <digit><code>

<uppercase> ::= A | C | E | G | J [1]

<passcode> ::= <uppercase><code> (an uppercase letter followed by the repeating part) [1]

<code> includes the three single options <lowercase> | <symbol> | <digit> [1]

<code> includes the three recursive options, each followed by <code> [1]

KEY IDEAA repeating loop in a syntax diagram is written in BNF as a rule that calls itself.
TOTAL 6 marks

Official mark scheme

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