Compiler Design Question Papers
Compiler Design Question Papers
MCA
(SEM. IlI) THEORY EXAMINATION,2021-22
KCA 015: COMPILER DESIGN
Time:3 Hours Total Marks: 100
Note: Attempt all Sections. If require any missing data;
then chose
suitably.
SECTION-A
Attempt all questions in brief. (2 x 10 = 20)
(a) Define Bootstrapping.
() Differentiate compiler and interpreter.
(c) Wite down drawbacks of predictive parser.
(d) List out the actions performed by shift reduce parser.
(e) Define the term abstract syntax tree.
() What are loop variant constraints?
(9) What are the various advantages of heap storage allocation?
(h) Define symbol table.
What is machine independent code optimization?
What are the issues to be considered during code generation?
SECTION-B
2. Attempt any'three of the following : (10 x 3 = 30)
(a) Define regular expression. Wite about the identity rules for
regular expressions.
(b) Discuss in brief about left recursion and left factoring with
examples,
(C) Explain reducible and non-reducible flow graphs with example.
(d) Explain various data structures for symbol table.
(e) Explain in brief about different principle sources of optimization
techniques.
SECTION-C
3. Attempt any one part of the following: (10 x 1= 10)
(a) Write a LEX program that recognizes the tokens in
Discuss it. PASCAL
(b) Discuss the role of lexical analyzèr in a compiler.
Attempt any one part of the following: (10 x 1 =10)
(a) Define ambiguous grammar. Explain it with an
(b) What are the problems in top down parsing? example.
suitable example. Explain each with
5.
Attempt any one part of the following: (10 x 1=10)
(a) Differentiate between synthesized and inherited attributes with
suitable example
(b) Translate the expression -(a + b)'(c +d) +(a+b+c) into
quadruple, triple and indirect triple.
(F.4] KPH FOR MCA
6.
:
Attempt any one part of the ívllowingtable (10 x1=10)
(a) Explain, in detail the symbol organization for block
structured languages
(b) Explain in brief about stack storage allocation strateg.
7. Attempt any one part of the folloving:stimization. (10 %1 =10)
(a) Explain in detail inter procE
(b) Explain different types of in. iate codes forms.
COMPILER DESIGN (F.5]
MCA
(SEM II) THEORY EXAMINATION, 2022 - 23
KCA 015: COMPILER DESIGN
Time:3 Hours Maximum Marks:100
Note Attempt all Sections. If you require any missing data, then
choose suitably.
SECTION -A
1. Attempt all questions in brief. (2 x 10 = 20)
(a) Discuss the need of cross compiler and how it can be
achieved?
(b) Describe the Arden's theorem.
(c) investigate the use of pass of a compiler. to clu
() Discuss the requirement of a "lookahead" feature in order to
specify their lexical Analyzers. omcIpo
(e) Demonstrate an example of parse tree and syntax tree.
Show the actions available with shift reduce parsers.
(9) Define a postfix notation.
(h) Explain peephole optimization.
() Define DAG.
What do you mean by machine dependent and machine
independent optimization?
SECTION -B
2. Attempt any three of the following: (10 x3 = 30)
(a) Describe the symbol table manager and error handler
routines.
(b) Examine the output of lexical analyzer for the following
program.
int max (x, y)
int x, y:
(©) What ate lhe dtflcules wili top dovn paising? Exetai with
4d) Vat are thn 4Ey8 Ci ag the pgdaco? Explein in
detai
(e) Discuss about ihe foilowing:
) Copy Propagation
(i) Dead-code Elimination
(F.6) KPH for MCA
SECTION -C
3. Attempt any one part of the following : (1x 10 =10)
(a) Consider the following grammar
E’E+E
EE*E
E’(E)
E’ id
Discover whether the above grammar is unamblguous or
not. If not convert it and also remove the left recursion from
the grammar.
(b) For the Regular expression (a/b)"a(a/b). Draw the NFA, Obtain
DFA form NFA.
Attempt any one part of the following : (1 x 10 = 10)
(a) Point out the various phases of compiler and write down the
output of each phase of the compilation for the expression a: =
(b +d) + (c* 5).
(b) lustrate how a lexical analyzer can be implemented and VWrite
a LEX program to identify octal and hexadecimal numbers and
implement specific action after identifying these tokens.
5. Attempt any one part of the following : (1 x 10= 10)
(a) Compute FIRST and FOLLOW for given Grammar
S ->aBDh
B ->cC
C->bC|¬
D ->EF
E->g|¬
F->f|¬
(b) Make use of the recursive descent parser to write the code in
CLanguage for the following grammar
E’ TE'
E+ TE'|E
T’FT'
T'*FT |¬
F’(E)| id
6. Attempt any one part of the following :
(a) (1 x 10 = 10)
Break down the 3-address code for the statements a =c*-d +
b*-c?
(b) Classify three types of implementations of
statements. three-address
7. Attempt any one part of the following: (1 x 10 = 10)
(a) What are the issues in the design of code generator? Explain
in detail.
(b) What is an activation record? Draw diagram of
General
Activation record and explain the purpose of different fields
an activation record. of