CC PRELIM SET B
Q1.Multiple Choice
Questions
1 Backpatching occurs due to _________________
a)
Procedure calls b) Jump statement c) Assignment statement d)
None
2 Dotted lines used in activation trees indicates
________________
a)
Execution of procedure is completed
b) Execution of procedure is yet not completed
c) Procedure is in execution d) none
3 Which of the following is not addressing mode?
a)
Register b) Absolute c) Indirect absolute d) indirect indexed
4 Which of the following is needed to locate data
needed by the called procedure but found elsewhere?
a)
Control lonk b) Access link c) Temporaries d)
Saved machine status
5 Which of the following is false?
a)
Instruction involving register operands are slower than those involving memory
operands
b) Graph coloring is used for register
allocation
c) Run time stack is used to keep
track of live procedure activations
6 The most powerful parser is
a)
SLR b) LALR c)
canonical LR d)
LL(1)
7 Which of the following is phase of compilation
process?
a) Lexical analysis b)
code generation
c) Static analysis d)
both a & b
8 The grammar S->
a sa|bs|c is
a)
LL(1) but not LR(1) b) LR(1) but not LL(1)
c) Both LL(1) and LR(1) d)
Neither LL(1) nor LR(1)
9 An ideal compiler should
a)
detect error b)
detect and repair error
c) detect repair & correct
error d) none of these
10 Which is the permanent database in the general
model of the compiler?
a)
Literal table b) Identifier table c) Terminal table d) Reductions
11 A bottom up parser generates
a)Left
most derivation b)Right most derivation
c)Right most derivation in
reverse d)Left most derivation in reverse
12 The grammar E->
E + E | E*E | a is
a)
Ambiguous b)
Unambiguous
c)
Ambiguous or not depends on given sentence
d) None
13 For which of the following situations, inherited
attribute is a natural choice
a)
Evaluation of a arithmetic expression b)
keeping track of variable declaration
c) Checking for correct use of L
values and R values d) b)
& c)
14 A syntax tree
a)
is another name for a parse tree b) is a condensed form of parse tree
c) Should not have keywords as
leaves d) All above
15 Which of the following symbol table
implementation makes efficient use of memory?
a)
List b) Search tree c)
Hash table d) self organizing list
16Which is not part of run time memory subdivision?
a)
Stack b) Static data c) Control link d) Heap
d) DAG is used to identify common
sub expressions in the basic block
17 The most powerful parser is
a)
SLR b) LALR c)
canonical LR d)
LL(1)
18 Implicit allocation stands for _______________
a)
Allocation does by user b)Allocation does by
programmer c)Allocation does by runtime support package d) None
19 For each available register, which of the
following is used to keep track of the variable names whose current value in
that register?
a)
Address descriptor b) Register descriptor c)
Variable descriptor d) None
20 What is the cost of following target code?
Ld
R1, a
Add
R1, b
ST
C, R1
a)
5 b) 4 c) 6
d) 3
2 Attempt any four: (5x4=20 Marks)
1.
What is compiler? Draw diagram for phases of compiler. And explain any three
in
detail.
2. What is
scanning? Show diagrammatically translation of
X= a – b * 50; and explain.
3.
What is parse tree? How it is used to prove that grammar is ambiguous? Explain
with suitable example.
4. For what we
use subset construction algorithm? Write & explain in detail the scheme.
5. How to eliminate left recursion
from a translation scheme? Explain with example.
3 Attempt any one:
10 Marks
a)
Focus on non recursive predictive parsing by giving suitable model. Write
predictive parsing program. And explain how to generate parsing table with
suitable example.
b)
When to say syntax directed definition is L attributed? Give the basic
requirements those are required for translation scheme. Give the ways to
implement these requirements. Write & explain the algorithm for construction
of a predictive syntax directed translator.
4
Explain
the predictive parsing for LL(1) grammar with the help of suitable example.
10Marks
5 Attempt any four: (5x4=20 Marks)
a)
Explain the syntax directed translation of case statement.
b)
Explain stack and heap allocation strategy with example.
c)
Explain code generation using DAG.
d)
What is optimization? Write characteristics of peephole optimization
e)
Discuss issues in the design of code generator.
6 Attempt any one:
10Marks
a) List and explain intermediate
languages in detail.
b)
Explain sources of optimization in detail.
7 Explain
basic block with example and write down algorithm for partitioning a 3-address
statement in to basic block with example. 10Marks
Comments
Post a Comment