Compiler Construction MCQ :Code Generation and Optimization-three address code, DAG, block graph : Link2

Compiler Construction MCQ :Code Generation and Optimization-three address code, DAG, block graph : Link2

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Code Generation and Optimization-three address code, DAG, block graph ? We have arranged the Show Answer button under the each question. Candidates can click on it to know the right option among the given alternatives. Furthermore, the applicants can check our web portal @ www.totalmcq.com to take part in more MCQ on various subject. Wish, the given information about the Compiler Construction MCQ will helpful to the advance and can learn the various types of questions and answers.


Q.1. The identification of common sub-expression and replacement of run time computations by compile-time computations is------

A. Local optimization
B. Constant folding
C. Loop optimization
D. Data flow analysis

Q.2. Which of the following class of statement usually produces no executable code when compiled?

A. Declaration
B. Assignment statements
C. Input and output statements
D. Structural statements

Q.3. Code optimization is responsibility of--------

A. Application programmer                                         B. System programmer
C. Operating system                                      D. All of the above.

Q.4. Dead-code elimination in machine code optimization refersto -----------

A. Removal of all labels.
B. Removal of values that never get used.
C. Removal of function which are not involved.
D. Removal of a module after its use.

Q.5. Which of the following statement is false?

A. Flow graph is used to represent DAG.
B. Three address code is the input to the code generator.
C. The first statement of three address code is always leader of the first basic block.
D. Transformation of block is needed for code optimization.

Q.6. -------- is the final phase of compiler.

A. Semantic analysis                                                                     B. Code generation
C. Target code generation                                                                    D. Syntax analysis

Q.7. Consider the following intermediate program in three address code
p = a - b
q = p * c
p = u * v
q = p + q
Which one of the following corresponds to a static single assignment form of the above code?

(A) p1 = a - b
q1 = p1 * c
p1 = u * c
q1 = p1 + q1
(B) p3 = a - b
q4 = p3 * c
p4 = u * c
q5 = p4 + q4
(C) p1 = a - b
q1 = p2 * c
p3 = u * c
q2 = p4 + q3
(D) p1 = a - b
q1 = p * c
p2 = u * c
q2 = p + q

Q.8.Some code optimizations are carried out on the intermediate code because------

A. They enhance the portability of the compiler to other target processors                                                               B. Program analysis is more accurate on intermediate code than on machine code
C. The information from dataflow analysis cannot otherwise be used for optimization                                                               D. The information from the front end cannot otherwise be used for optimization

Q.9. Peephole optimization is form of------

A. Loop optimization                                       B. Local optimization
C. Constant folding                                                D. Data flow analysis

Q.10. In compiler terminology reduction in strength means-----

A. Replacing run time computation by compile time computation
B. Removing loop invariant computation
C. Removing common subexpressions
D. replacing a costly operation by a relatively cheaper one

Q.11. Substitution of values for names (whose values are constants) is done in----------

A. Local optimization                                                                 B. Loop optimization
C. Constant folding                                                                   D. Strength reduction

Q.12. Which of the following comment about peep-hole optimization is true?

A. It is applied to small part of the code and applied repeatedly                                                                B. It can be used to optimize intermediate code
C. It can be applied to a portion of the code that is not contiguous                                                                      D. It is applied in symbol table to optimize the memory requirements

Q.13. CWhich of the following statements about peephole optimization is False?

A. It is applied to a small part of the code                              B. It can be used to optimize intermediate code
C. To get the best out of this, it has to be applied repeatedly                        D. It can be applied to the portion of the code that is not contiguous

Q.14. Quadruple is a record structure with four fields-------

A. Op, arg1, arg2 and result
B. op1, op2, arg2 and result
C. arg1, arg2, result and op
D. All of the above.

Q.15. Graph used to represent semantic network is ----

A. Undirected graph                              B. Directed graph
C. Directed Acyclic graph (DAG)                                  D. Directed complete graph