Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software

Q31 · 9618/33/O/N/24 Q10

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

Q319618/33/O/N/24original Q10Structured · 9 marks
Question 10 from 9618/33/O/N/24

Worked solution

(a)

Each syntax diagram becomes one BNF rule. A choice becomes | and a box that can be skipped becomes two alternatives.

<operator> ::= + | – | * | / [1]

<label> ::= <letter><digit> | <letter><digit><digit> [1]

For <equation>, write the first part: <equation> ::= <label> = [1]

Then add the second part: <label><operator><label> [1]

(b)(i)

Draw one line from the start. It splits into two routes: a letter box or a symbol box. Both routes join again before a digit box. After the digit, put a symbol box, then a second symbol box that can be skipped by a bypass line, before the end arrow.

Start goes to either letter or symbol [1]

Ends with one symbol or two symbols (second symbol can be bypassed) [1]

Digit box, and all other connections and the label password correct [1]

(b)(ii)

Write out every possible first character, then the digit, then one or two symbols.

<password> ::= <letter><digit><symbol> |
    <letter><digit><symbol><symbol> |
    <symbol><digit><symbol> |
    <symbol><digit><symbol><symbol>

First option, <letter><digit><symbol>, correct [1]

The other three options correct [1]

Another correct way uses helper rules: <first> ::= <letter>|<symbol>, <last> ::= <symbol>|<symbol><symbol> and <password> ::= <first><digit><last>. Any two correct lines score [1], all three [2].

KEY IDEAA syntax diagram and BNF show the same rule: a choice is |, and an optional or repeated part needs its own alternatives or a recursive rule.
TOTAL 9 marks

Official mark scheme

Mark scheme for 9618/33/O/N/24 question 10
VIDEO
▶ Whole paper

Video solution of the whole paper · by Zafar Ali Khan (ZAK). 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.