International Institute of Professional Studies, DAVV IC-901(A)
End-Semester Exam Jul-Dec, 2021
MCA (5 Yrs) IX Semester
Compiler Design
Time: 3 Hrs Max.Marks:60
Instructions to the Candidate:
Note: Attempt any five questions out of seven.
All questions carry equal marks.
Q.(1) (a) How would you recognize the tokens in Lexical Analyzer?
Q.(1)(b) Explain Different Phases of Compiler? Briefly explain each Phase?
Q.(2)(a) Draw a DFA for the language accepting strings starting with ‘00’ or '11' over input
alphabets ∑ = {0, 1} ?
Q.(2)(b) Let a CFG {V,T,P,S} E → E+E / E*E / E / int & int -> 2/3/4/5 One derivation
from the above CFG is “2*3+5”? Show LMD and RMD Parse tree.
Q.(3)(a) Compare Top Down Parsing with Bottom Up Parsing with example?
Q.(3)(b) Explain Single pass and Multi-pass Compiler in detail?
Q.(4)(a) Find the FIRST and FOLLOW sets for each Non Terminal.
S-> aAB|bA|ε
A-> aAb|ε
B→bB|ε
Q.(4)(b) Explain the difference between Compiler and Interpreter with example?
Q.(5)(a) Consider the following grammar: Construct the SLR parsing table and also parse
the input “a*b+a”
E-> E+T|T
T-> TF|F
F-> F*|a|b
Q.(5)(b) Consider the following switch statement and write three address code for that
switch (i + j)
{
case 1: x = y + z ;
default: p = q + r ;
case 2: u = v + w ;
}
Q.(6)(a) Show the following grammar, Is LR(1) but not LALR(1).
S->Aa|bAc|Bc|bBa
A->d B->d
Q.(6)(b) Write quadruples, triple and Indirect triple for expression:
-(a+b)*(c+d)-(a+b+c)
Q.(7) Write short notes (Any Two)
1. Backtracking
2. Grammar and Language
3. Cross Compiler
4. Syntax Directed Definition
****************************