Past-paper question · 2015 October-November · Paper 32 · Q2(d)(iii)

Question 2(d)(iii) 2015 · October-November · Paper 32 · 0 marks

Original past-paper question for 2(D)(III)
Original past-paper question for 2(D)(III)
Original past-paper question for 2(D)(III)
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_32.pdf →

Show text version of question

Question 2

Part (d)

(iii)

Question 2

In this question, you are shown pseudocode in place of a real high-level language. 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 to 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:

Start 0.1 // Output values in loop FOR Counter Start TO 10 OUTPUT Counter + Start ENDFOR The final stage of compilation is optimisation. There are a number of reasons for performing optimisation. One reason is to produce code that minimises the amount of memory used.

(iii)

These lines of code are to be compiled:

X A + B Y A + B + C

Following the syntax analysis stage, object code is generated. The equivalent code, in assembly language, is shown below:

LDD 436 //loads value A ADD 437 //adds value B STO 612 //stores result in X LDD 436 //loads value A ADD 437 //adds value B ADD 438 //adds value C STO 613 //stores result in Y

Topic relevance

Why this question appears here

86% assigned-topic match · Processor fundamentals › Assembly language

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

Keep practising this topic