Compiler Design Question Bank
Compiler Design Question Bank
RCS502/KIT052
Question Bank: Unit 1
Short answer type questions
1 Differentiate between compiler and assembler.
2 Write down short note on symbol table.
3 Define Lexeme, tokens and pattern with example.
4 Discuss different phases of compiler with an example.
5 Discuss analysis-synthesis model in detail.
6 Differentiate between Left most derivation and Right most derivation with the help of grammar.
7 Discuss the concept of Ambiguity with the help of a grammar and also discuss its removal.
8 Draw the minimized DFA for the regular expression a(a+b)*
9 Discuss the working of lexical analyzer and how input buffering is used for recognition of token.
10 Discuss the concept of bootstrapping with an example.
11 Discuss the concept of Left factoring with the help of an example.
12 Discuss the algorithm for conversion of NFA to DFA with an example.
13 Discuss the algorithm of minimization of DFA with an example.
14 Define Parse tree.
15 Discuss the concept of LEX.
Unit 2
Short answer type questions
1 Explain difference between Top down parsing and bottom up parsing.
2 Construct predictive parsing table for the grammar
E➔TE’
E’➔TE’ | є
T➔FT’
T’➔*FT’ | є
F➔€ | id
S➔AaAb | BbBa
A➔a
B➔b
8 Construct SLR(1) parsing table of a given grammar and parse the input string “ aabb ” :
S➔AA
A➔aA | b
9 Construct CLR(1) parser of a given grammar:
S➔AA
A➔aA | b
10 Construct LALR(1) parsing table with the help of CLR(1) parsing table in question9
S➔AaAb | BbBa
A➔a
B➔b
S➔AaAb | BbBa
A➔a
B➔b
Unit 3
Short answer type questions
1 Generate three address code for the following:
c = 0;
do{
if ( a<b ) then
x++;
else
x--;
c++;
}while(c<5)
Unit 4
Short answer type questions
1 What is Symbol Table?
2 What is the use of symbol table?
3 What are the data structure used in symbol table?
4 What are the functions used in symbol table?
5 How the description of scope of a variable is represented in Symbol Table?
6 Explain activation tree with example.
7 What do you mean by error detection and error recovery in compiler?
8 Classify the types of ERROR.
9 Explain the four strategies of Error Recovery.
10 Explain Lexical phase and Syntactic phase error detection.
11 What is Symbol table with entries? Also, explain the data structures used for symbol table
12 Discuss the following storage allocation strategies with example:
a) Static Allocation
b) Stack Allocation
c) Heap Allocation
13 What do you mean by run time storage management? Explain Activation record and display
structures.
14 What are various types of errors that may appear in compilation process? Explain the functions
of error handling phase of Compiler.
15 Explain storage allocation for block structure languages.
Unit 5
Short answer type questions
1 What are the tasks of code generator?
2 What are the issues in the design of a code generator?
3 What are the modes of addressing in the target code?
4 Explain static allocation in the target code with example.
5 Explain stack allocation in the target code with example.
6 Explain procedure call in target code.
7 How basic blocks can be created? Explain with example.
8 Explain a flow graph with example.
9 What are the advantages of creating DAG of basic blocks?
10 How DAG can be represented of an Array reference?
11 Write short notes on Peephole optimization.
12 Explain the algorithm for following with example-
a) Global and local common sub expression elimination
b) Induction variable detection and elimination
13 Discuss Loop Optimization techniques with example.
14 Define basic block. Explain the algorithm for partitioning a sequence of three address code into
basic blocks. Illustrate with example.
15 Write short notes on:
a) Induction variable elimination
b) Common sub expression elimination
c) DAG representation of basic blocks and application of DAG
d) Control flow analysis
e) Data flow analysis
f) Loop unrolling and loop jamming
17. The graph that shows basic blocks and their successor relationship is called
a) Flow graph
b) Control graph
c) Hamiltonian graph
d) DAG
Answer - a