0% found this document useful (0 votes)
116 views3 pages

Cat-2 QB

This document contains multiple choice questions related to compiler design topics like intermediate code representation, syntax trees, control flow graphs, code optimization techniques, and code generation. Specifically: 1) A control flow graph represents the basic blocks and successor relationships in a program. 2) Constant folding replaces runtime computations with compile-time computations by evaluating expressions containing constants. 3) Inherited attributes are useful for syntax-directed definitions involving attributes computed from ancestor nodes in a parse tree.

Uploaded by

Preethikaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views3 pages

Cat-2 QB

This document contains multiple choice questions related to compiler design topics like intermediate code representation, syntax trees, control flow graphs, code optimization techniques, and code generation. Specifically: 1) A control flow graph represents the basic blocks and successor relationships in a program. 2) Constant folding replaces runtime computations with compile-time computations by evaluating expressions containing constants. 3) Inherited attributes are useful for syntax-directed definitions involving attributes computed from ancestor nodes in a parse tree.

Uploaded by

Preethikaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Which of the following class of statement usually produces no executable code when

compiled?
1. a) Declaration b) Assignment Statements c) Input and Output statements d) Control
statements

Three address statement is an abstract form of


2. a) Source Program b) Intermediate code c) Target Program d) Assembly Program

A parse tree showing the values of attributes at each node is called


3. a)Abstract syntax tree b)Parse Tree c) Annotated Parse tree d) Semantic Tree

The graph that shows basic blocks and their successor relationship is called
4. a)DAG b)Hamilton Graph c)Control Graph d) Flow graph

In activation record, Which of the following stores the address of activation record of the
5. caller procedure?
a) Control Link b) Access Link c) Actual Parameters d) Temporaries

The execution time of the code depends on?


6. a) the orders in which the computations are performed b) the usage of machine idioms
c) the way the registers are used d) Target code
__________ are used to keep track of memory locations where the values of identifiers are
stored.
7. a) Register descriptor b) Static descriptor c) Address descriptor d) semantic
descriptor

In compiler terminology, reduction in strength means


a) Replacing run time computation by compile time computation
8. b) Removing loop invariant computation c) Removing common sub
expressions d) Replacing a costly operation by a relatively cheaper one

Multiplication of a positive integer by a power of two can be replaced by left shift, which
executes faster on most machines,is an example of?
9. a) Strength Reduction b) Peephole optimization c) Loop unwinding d) Constant
folding

Consider a program P that consists of two source modules M1 and M2 contained in two
different files. If M1 contains a reference to a function defined in M2, the reference will be
10. resolved at
a) Edit-time b) Link-time c) Compile-time d) Load-time

Inherited attribute is a natural choice in?

11. a) Variable declarations record is maintained b) L values and R values


c) c) Syntax Address Translation d) Syntax Definition.

The DAG representation of a Quadruples is called


12.
a)Nodes b) Leaves c) Tree d) Pattern.
Which of the following is used to construct a DAG in a good way of determining
common sub expression.
13. a)2 address statement b) 4 address statement c) 3 address statement d) 5 address
statement

Specify the one which is associating the attributes with the grammar symbols.
14.
a)rotation b)translation c)transformation d)evolving

Which of the following is used to keep track of the location.


15. a)Flag register b) Address descriptor c) Allocation descriptor d) register

In which the following will invoke a function GETREG ().


a)Code optimization b) Code motion c) the code generation algorithm d)
16.
intermediate code.

The graph that shows the basic blocks and their successor relationship is called

17. (A) Hamiltonian graph (B) Control graph (C) Flow graph (D) DAG

From anyone in the loop to any other, there is a path of length one or more is called.

18. a)Weakly Connected b) Unique Entity c) Multi Connected d) Strongly Connected

An optimizing compiler

19. (A) Is optimized to occupy less space (B) Optimized the code (C) Is optimized to take
less time for execution (D) Less Compilation

Which of the following techniques is used to replace run-time computations by compile


time computations?
20.
(A) Constant folding (B) Code hoisting (C) Peephole optimization (D) Invariant
computation

PART-B
1. Give a brief note on Inherited Attributes with an example.
State the different issues in the design of code generation.
2.
3. What is backpatching?
4. Define “Next-Use” information.
5. Write SDT for Arithmetic and Boolean expressions
6.

Construct the Annotated Parse tree using Synthesized attribute for 4*5+6 and Inherited
attribute for int a,b,c.

7. Define Activation Record and list the fields in activation record.


8. Write the concepts of basic blocks and flow graphs.
9. What is dead code elimination? Give example.
10. Write SDT for Arithmetic and Boolean expressions

PART-C
Construct basic blocks and flow graph for the following source code.
begin
prod := 0;
i := 1;
do begin
1. prod := prod + a[i] * b[i];
i := i+1;
end
while i < = 20
end

2 Write the implementations of three address statement with suitable examples.


3 Write the Syntax-Directed Translation schemes for Procedural statements.
4 Justify with an example, about the Principal Sources of Code Optimization.
5 Apply various storage allocation strategies during Run-time environment for the target
code of your choice.
6 Write a simple code generator algorithm. With an example code, show how the algorithm
generates code.
7 Write the different issues in the design of code generator?
8 Analyze Peephole optimization with suitable examples

You might also like