Compiler Design MCQ Questions And Answers - Code Generation

This section focuses on "Code Generation" in Compiler Design. These Multiple Choice Questions (MCQs) should be practiced to improve the Compiler Design skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.

1. Code generation can be considered as the?

A. first phase of compilation
B. second phase of compilation
C. third phase of compilation
D. final phase of compilation

View Answer

2. ___________ is a tool that depicts the structure of basic blocks, helps to see the flow of values flowing among the basic blocks, and offers optimization too.


View Answer

3. In Directed Acyclic Graph, Leaf nodes represent?

A. identifiers
B. names 
C. constants
D. All of the above

View Answer

4. In Algebraic expression simplification, a = a + 1 can simply be replaced by?

A. a
B. INC a
C. DEC a
D. MUL a

View Answer

5. x * 2 can be replaced by x << 1 is an example of?

A. Algebraic expression simplification
B. Accessing machine instructions
C. Strength reduction
D. Code Generator

View Answer

6. The following code is an example of?

void add_ten(int x)
   return x + 10;
   printf(""value of x is %d"", x);

A. Redundant instruction elimination
B. Unreachable code
C. Flow of control optimization
D. None of the above

View Answer

7. How many descriptors are used for track both the registers (for availability) and addresses (location of values) while generating the code?

A. 2
B. 3
C. 4
D. 5

View Answer

8. __________ are used to keep track of memory locations where the values of identifiers are stored.

A. Register descriptor
B. Address descriptor
C. Both A and B
D. None of the above

View Answer

9. Code generator uses ______ function to determine the status of available registers and the location of name values.

A. setReg
B. cinReg
C. pfReg
D. getReg

View Answer

10. Which of the following is not a form of Intermediate representation?

A. Abstract Syntax Tree
B. 3-address code
C. Directed cyclic Graph
D. Reverse Polish Notation

View Answer


* You must be logged in to add comment.