Past-paper question · 2018 October-November · Paper 32 · Q4(a)

Question 4(a) 2018 · October-November · Paper 32 · 3 marks

Original past-paper question for 4(A)
Original past-paper question for 4(A)
Reveal official mark-scheme answer Official mark-scheme answer for 4(A)

Official answer for Question 4

Part (a)

Question 1

mark per row

Question 3

✓
Token
✓
Symbol
✓
Value
✓
Type
✓
Number1

Question 60

✓
Variable
✓
Number2

Question 61

✓
Variable
✓
Answer

Question 62

✓
Variable

Question 10

Question 63

✓
Constant//Literal
✓
0

Question 64

✓
Constant//Literal

Mark scheme 9608_w18_ms_32.pdf →

Show text version of question

Question 4

Part (a)

Question 4

A compiler uses a keyword table and a symbol table. Part of the keyword table is shown.

  • Tokens for keywords are shown in hexadecimal.
  • All of the keyword tokens are in the range 00 – 5F.

Keyword Token 01 + 02 = 03

IF 4A THEN 4B ENDIF 4C ELSE 4D FOR 4E STEP 4F TO 50 INPUT 51 OUTPUT 52 ENDFOR 53

Entries in the symbol table are allocated tokens. These values start from 60 (hexadecimal).

Study the following code.

INPUT Number1 INPUT Number2 INPUT Answer IF Answer = Number1 + Number2 THEN OUTPUT 10 ELSE OUTPUT 0 ENDIF

Part (a)

Complete the symbol table to show its contents after the lexical analysis stage.

Token Symbol Value Type Number1 60 Variable Number2 61 Variable

[3]

Question 9

Topic relevance

Why this question appears here

99% 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_w18_qp_32.pdf

Keep practising this topic