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

Question 4(c)(i) 2018 · October-November · Paper 32 · 1 mark

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

Official answer for Question 4

Part (c)

(i)

✓
(Code) Optimisation

Question 1

Mark scheme 9608_w18_ms_32.pdf →

Show text version of question

Question 4

Part (c)

(i)

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

A
student uses the compiler to compile some different code.

After the syntax analysis is complete, the compiler generates object code.

The following line of code is compiled: X A + B + C − D

The compilation produces the following assembly language code.

LDD 236 // loads value A into accumulator ADD 237 // adds value B to accumulator ADD 238 // adds value C to accumulator STO 540 // stores accumulator in temporary location LDD 540 // loads value from temporary location into accumulator SUB 239 // subtracts value D from accumulator STO 235 // stores accumulator in X

(i)

Identify 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_w18_qp_32.pdf

Keep practising this topic