Past-paper question · 2018 May-June · Paper 31 · Q5(b)

Question 5(b) 2018 · May-June · Paper 31 · 4 marks

Question 5

Part (b)

Question 5

The following syntax diagrams show the syntax of:

  • an assignment statement
  • a variable
  • a signed integer
  • a letter
  • a digit
  • an operator

assignment statement variable = variable operator signed integer

variable letter letter

signed integer + digit

-

letter x

y

z

digit operator 1 ˄

2 \

Question 3

Question 4

Question 5

Question 11

Part (b)

Complete the Backus-Naur Form (BNF) for the syntax diagrams on the opposite page.

<assignment statement> ::=

...................................................................................................................................................

<variable> ::=

...................................................................................................................................................

<signed integer> ::=

...................................................................................................................................................

<operator> ::=

...................................................................................................................................................

[4]
Reveal official mark-scheme answer Official mark-scheme answer for 5(B)

Official answer for Question 5

Part (b)

Question 1

mark per bullet

Question 4

✓
assignment
  • <variable>=<variable><operator><signed integer>
✓
variable
  • <letter><letter>
✓
signed integer
  • +<digit> | -<digit>
✓
operator
✓
•
✓
^ | \
✓
<assignment statement> ::=
✓
<variable> = <variable><operator><signed integer>
✓
<variable> ::= <letter><letter>
✓
<signed integer> ::= +<digit> | -<digit>
✓
<operator> ::= ^ | \

Mark scheme 9608_s18_ms_31.pdf →

Topic relevance

Why this question appears here

71% assigned-topic match · Programming › Programming basics

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9608_s18_qp_31.pdf

Keep practising this topic