Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software

Q23 · 9618/32/M/J/23 Q3

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

Q239618/32/M/J/23original Q3Structured · 9 marks
Question 3 from 9618/32/M/J/23

Worked solution

(a)

A variable is one or more letters, then at most one digit. It must begin with a letter.

9SW: invalid, because it begins with a digit and a variable must begin with a letter [1]

UWY: valid, because it begins with a letter and is followed by two other letters [1]

(b)

<word> is one or more letters, so it needs a rule that repeats itself:

<word> ::= <letter> | <word><letter>
<variable> ::= <word> | <word><digit>

<word> ::= <letter> | [1]

... <word><letter> [1]

<variable> ::= <word> | <word><digit> [1]

Also accepted: <word> ::= <letter><word> | <letter>.

(c)(i)

Use two letters and one to three digits from the diagrams.

Write an example such as AC768 [1]

(c)(ii)

Draw a diagram named vehicle registration, with an arrow in and an arrow out, in this order: letter box, letter box, digit box, then a second digit box and a third digit box that can each be skipped by a bypass line.

Always exactly two letters (two letter boxes, no loops) [1]

One, two or three digits possible (the extra digit boxes can be bypassed) [1]

Correct arrows, boxes and name of the syntax diagram [1]

KEY IDEAFixed counts are drawn as separate boxes; optional extras are boxes with a bypass line.
TOTAL 9 marks

Official mark scheme

Mark scheme for 9618/32/M/J/23 question 3
VIDEO
▶ Whole paper

Video solution of the whole paper · by qiphyedu. 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.