Tutorial 7.0 (C) 2 Hours
Tutorial 7.0 (C) 2 Hours
0: INTRODUCTION TO PROGRAMMING
LO : c) Differentiate types of language translators (compiler, interpreter and assembler)
(2 Hours)
1. A translator is a programming language processor that converts a computer program from one language to
another.
Identify the translator based on the statement given. [3 marks]
Statement Translator
Convert one instruction of the source program at a time into machine Interpreter
language and then immediately executed by the computer or mobile.
Converts the entire source program into machine language before executing Compiler
it.
Converts program written in assembly language to machine code. Assembler
2. A translator is a programming language processor that converts a computer program from one language to
another. Answer the following question based on Figure 1 below.
Figure 1
State the appropriate X and Y. [2 marks]
X: Compiler
Y: Interpreter
Figure 2
X: Translator
b) State the function of X in 3a). [2 marks]
1. Identify the appropriate type of translator based on the given description of the translator function. [3 marks]
2. Figure 1 shows three different program segments written using different types of programming languages.
Figure 1
Name the translator used to convert Program2 into executable codes. [1 mark]
=Interpreter
Name the translator that can be used to translate the programming language Q. [2 marks]
=Interpreter
4. Describe the function for each of the translators listed below. [2 marks]
Compiler Translates an entire program written in high level language into an equivalent program in
machine language
Interpreter Translates a program’s statements line by line at a time written in high level language into an
equivalent program in machine language
UPS DC045 SESI 2014/2015
5. A programming language is a formal language designed to communicate with a machine, particularly a
computer.
a) Programs written in a high-level language can be compiled or interpreted.
(i) Define a compiler. [1 mark]
=A program that translates an entire program written in high level language into an equivalent
program in machine language
(ii) Define an interpreter. [1 mark]
=A program that translates a program statements line by line at a time written in high level
language into an equivalent program in machine language
b) Identify the type of translators that can convert the assembly instructions into machine code.[1 mark]
=Assembler
Figure 2
Figure 3
Identify and state the type of translator that translates the following program. State ‘None’ if a translator is
not relevant. [3 marks]
Program Type of translator
Program A to Program B Interpreter
Program C to Program A Compiler
Program C to Program B Compiler
11. There are three types of translator which are key processes in computer programming.
a) Distinguish between assembler and compiler. [4 marks]
=Assembler translates a program statements written in assembly language into an equivalent
program in machine language while compiler translates an entire program statements written
in high level into an equivalent program in machine language.
b) [3 marks]
Name and describe the third type of translator.
=Interpreter. A program that translates a program statements line by line at a time written
in high level language into an equivalent program in machine language
13. Classify a suitable programming language paradigm based on the given description. [3 marks]
The program statements that express facts and rules Logic programming
about problem within a formal logic system.