Past-paper question · 2015 October-November · Paper 31 · Q2(c)(i)

Question 2(c)(i) 2015 · October-November · Paper 31 · 1 mark

Original past-paper question for 2(C)(I)
Original past-paper question for 2(C)(I)
Original past-paper question for 2(C)(I)
Reveal official mark-scheme answer

The answer for this question is in the official mark scheme: open the mark scheme.

Mark scheme 9608_w15_ms_31.pdf →

Show text version of question

Question 2

Part (c)

(i)

Question 2

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

  • Tokens for keywords are shown in hexadecimal.
  • All 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 piece of code:

Counter 1.5 INPUT Num1 // Check values IF Counter = Num1 THEN Num1 Num1 + 5.0 ENDIF This line of code is to be compiled:

A
B + C + D

After the syntax analysis stage, the compiler generates object code. The equivalent code, in assembly language, is shown below:

LDD 234 //loads value B ADD 235 //adds value C STO 567 //stores result in temporary location LDD 567 //loads value from temporary location ADD 236 //adds value D STO 233 //stores result in A

(i)

Name the final stage in the compilation process that follows this code generation stage.

.......................................................................................................................................[1]

Topic relevance

Why this question appears here

75% assigned-topic match · System software › Language translators

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_w15_qp_31.pdf

Keep practising this topic