Test 3 (Section 3.2) Name: . .. Date: Sign: . Comments & Mark: ..

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Test 3 (Section 3.

2)

Name: …………………………………………………….……………………………..

Date:………………………………………… Sign:…………………………………….

Comments & Mark: ………………………………………………………………..…

1. Explain why the size of the memory available is particularly relevant to the process of compilation[4]
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...………………………………………………………………………
2. Explain the difference between the two translation techniques of interpretation and compilation[2]
…………………………………………………………………………………………………………...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...…………………………………………………………………………

3. Give one advantage of the use of each of the two translation techniques[2]
…………………………………………………………………………………………………………...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
...

1
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...………………………………………………………………………

4. State the three stages of compilation and describe briefly the purpose of each[6]
…………………………………………………………………………...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
…………………

5. Explain in detail the stage of compilation known as lexical analysis[6]

……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
………………………………….
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
….…………………………………………………………………

May/June 2003
6. If a sequence of high level language instructions is inside a loop and that loop will be executed 2000
times,explain why using an interpreter to run this sequence will be slower than running a compiled
version. [2]
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………….
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………..
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………

2
…...
……………………………………………………………………………………………………………

October / November 2003


7. Explain why an interpreter would be preferred to a compiler as a translator when writing a high level
language program. [5]
…………………………………………………………………………………………………………...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
……………………………………………………………………………………...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…………………………………………………………………………………………….
October/November 2004
8. Explain the purpose of linkers and loaders when running a program. [6]
………………………...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
……………………………………………………………………………………...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
……………………………………………………………………………………...
……………………………………………………………………………………………………………
……………………………………………………………………………………...
…………………………………………………………………………………………………

3
May/June 2005
9. Describe two things that happen during code generation. [4]
……………………………………………...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……………………………………………………………………………...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...………………
May/June 2006
10. (a) Explain why a program, written in a high level language, needs to be translated before it is run on
a computer. [2]
(b) Explain how errors in the
(i) reserved words,
(ii) variables used in high level language instructions are recognized by the translator program. [4]
…………………………………………………………...
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...

4
……………………………………………………………………………………………………………
...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
…...
……………………………………………………………………………………………………………
……...…………

[Total Marks 43]

You might also like