Question 4(c)(i) 2019 · May-June · Paper 31 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (c)
(i)
Question 1
mark per bullet point
Question 3
- Removing the fourth line (LDD 238)
- Changing operand for second ADD from 236 to 238
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 <> 04
IF 4A THEN 4B ENDIF 4C ELSE 4D REPEAT 4E UNTIL 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 pseudocode.
Counter 0 INPUT Password REPEAT IF Password <> "Cambridge" THEN INPUT Password ENDIF Counter Counter + 1 UNTIL Password = "Cambridge" OUTPUT Counter
Question 9
The following table shows assembly language instructions for a processor which has one general purpose register, the Accumulator (ACC).
Instruction Explanation Op code Operand Direct addressing. Load the contents of the location at the given LDD <address> address to ACC ADD <address> Add the contents of the given address to the ACC STO <address> Store the contents of ACC at the given address
After the syntax analysis is completed successfully, the compiler generates object code.
The following lines of high level language code are compiled.
X = X + Y Z = Z + X
The compilation produces the assembly language code as follows:
LDD 236 ADD 237 STO 236 LDD 238 ADD 236 STO 238
(i)
The final stage in the compilation process that follows this code generation stage is code
optimisation.
Rewrite the equivalent code after optimisation.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.....................................................................................................................................
Why this question appears here
87% 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_s19_qp_31.pdf
