Compiler Design Final Exam (50%) For 5th Year Students
Rift Valley University (L.Tafo Campus)
11/11/2022
Allotted Time: 1:30 Hour
NAME: _______________________________ ID: ___________________SECTION:_____
Part I: Write “True” if the statement is correct and Write “False” if the statement is
not Correct ( 2 mark each).
1. Compiler is different on different platform.T
2. The Java compiler produces machine code.F
3. Assemblers is translate byte code into machine code.T
4. Loader produce input to a compiler.F
5. A lexical analyser is scanner.T
6. Flex pouces C source code UNIX/linux.F
Part II: Choose the correct answer from the following questions (1.5 marks each).
1. What is a compiler?
a) system program that converts instructions to machine language
b) system program that converts machine language to high-level language
c) system program that writes instructions to perform
d) None of the mentioned
2. Which of the following is a stage of compiler design?
a) Semantic analysis c) Code generator
b) Intermediate code generator d) All of the mentioned
3. What is the use of a symbol table in compiler design?
a) Finding name’s scope
b) Type checking
c) Keeping all of the names of all entities in one place
d) All of the mentioned.
4. Which of the following error can a compiler check?
a) Syntax Error c) Both Logical and Syntax Error
b) Logical Error d) Compiler cannot check error.
5. A programmer, writes a program to multiply two numbers instead of dividing them by
mistake, how can this error be detected?
a) Compiler or interpreter. c) Interpreter only.
b) Compiler only. d) None of the mentioned.
6. Who is responsible for the creation of the symbol table?
a) Assembler c) Interpreter
b) Compiler d) All of the mentioned.
7. Which of the following is known as a compiler for a high-level language that runs on
one machine and produces code for a different machine?
a) Cross compiler
b) Multi pass compiler
c) Optimizing compiler
d) One pass compiler
8. Which of the following is a system program that integrates a program’s individually
compiled modules into a form that can be executed?
a) Interpreter
b) Assembler
c) Compiler
d) Linking Loader
9. Which of the following is a definition of compiler?
a) Acceptance of a program written in a high-level language and produces an object
program
b) Program is put into memory and executes it
c) Translation of assembly language into machine language
d) None of the mentioned
10. What is the output of lexical analyser?
a) A set of RE c) Set of Tokens
b) Syntax Tree d) String Character
11. Which symbol table implementation is based on the property of locality of reference?
a) Linear list c) Hash Table
b) Search tree d) Self Organisation
12. Which of the following is true for operator precedence parsing?
a) For all pair of non-terminal c) To delimit the handle
b) For all pair of non-terminals d) None of the mentioned
13. Which concept of FSA is used in the compiler?
a) Lexical analysis c) Code generation
b) Parser d) Code optimization
14. Which of the following phase of the compiler is Syntax Analysis?
a) Second c) First
b) Third d) All of the mentioned
15. Which of the following concept of FSA is used in the compiler?
a) Code optimization c) Lexical analysis
b) Code generation d) Parser
16. Which of the following is a part of a compiler that takes as input a stream of characters
and produces as output a stream of words along with their associated syntactic
categories?
a) Optimizer c) Parser
b) Scanner d) None of the mentioned
17. What is CFG?
a) Regular Expression c) Language expression
b) Compiler d) All of the mentioned
18. In which of the following phase of the compiler is Lexical Analyser?
a) Second c) First
b) Third d) All of the mentioned
19. Which of the following are Lexemes?
a) Identifiers c) Keywords
b) Constants d) All of the mentioned
20. Characters are grouped into tokens in which of the following phase of the compiler
design?
a) Code generator. c) Parser.
b) Lexical analyser. d) Code optimization.
21. Which of the following can detect an error if a programmer by mistake writes
multiplication instead of division?
a) Interpreter c) Compiler
b) Compiler or interpreter test d) None of the mentioned
22. What constitutes the stages of the compilation process?
a) Feasibility study, system, design, and testing
b) Implementation and documentation
c) Lexical analysis, syntax, Analysis and code generation
d) None of the mentioned
23. The lexical analyzer takes _________ as input and produces a stream of _______ as
output.
a) Source program, tokens c) Either of the two
b) Token, source program d) None of the mentioned
24. Parsing is also known as ________
a) Lexical Analysis c) Semantic Analysis
b) Syntax Analysis d) Code Generation
25. A compiler program written in a high level language is called ________
a) Source Program c) Machine Language Program
b) Object Program d) None of the mentioned
26. Which of the following is not a feature of compiler?
a) Scan the entire program first and translate into machine code
b) To remove syntax errors
c) Slow for debugging
d) Execution time is more.