QUESTION BANK
UNIT -1
PART-A: SHORT ANSWER QUESTIONS
S. No. QUESTION BTL CO
1 What is Compiler? Describe the Analysis and Synthesis parts of a L1 CO1
Compiler.
2 List and explain the properties of compiler. L2 CO1
3 What is a translator? Write down the steps to execute a program. L2 CO1
4 Discuss all the phases of compiler with a neat diagram. L2 CO1
5 What is the role of a Lexical Analyzer in a compiler? L2 CO1
6 List the major data structures in a compiler L1 CO1
7 Write a short note on: L1 CO1
a. Pass
b. Bootstrapping
c. LEX Compiler
d. Tokens, Patterns and Lexemes
e. Porting
f. Input Buffering.
8 Differentiate between compiler and interpreter. L2 CO1
PART-B: LONG ANSWER QUESTIONS
S. No. QUESTION BTL CO
1 Show the translation process of compiler for the given expression L3 CO1
Success: = effort + IQ ∗100.
2 Explain the phases of a Compiler with an example for each phase and L3 CO1
explain Translation process of each phase.
3 What do you mean by LEX? Explain in detail about LEX specification L2 CO1
with an example?
UNIT –II
PART-A: SHORT ANSWER QUESTIONS
S. No. QUESTION BTL CO
1 Explain the parsing techniques with a hierarchical diagram. L1 C02
2 What are the problems associated with Top Down Parsing? L2 CO2
3 Write the production rules to eliminate the left recursion and left L3 CO2
factoring problems.
Consider the following Grammar: A-> ABd|Aa|a
B-> Be|b
Remove left recursion.
4 Do left factoring in the following grammar: L3 CO2
A-> aAB|aA|a
B-> bB|b
5 Write the rules to construct the LR(1) items L1 CO2
6 Write the rules to construct the SLR parsing table. L1 CO2
PART-B: LONG ANSWER QUESTIONS
S. No. QUESTION BTL CO
1 Write a short note on: L1 CO2
a. Ambiguity (with example)
b. Recursive Descent Parser
c. Predictive LL(1) parser (working)
d. Handle pruning
e. Operator Precedence Parser
2 Write Rules to construct FIRST Function and FOLLOW Function. L3 CO2
Consider Grammar: E-> E+T|T
T-> T*F|F
F-> (E)|id
3 Show the following Grammar: L3 CO2
S-> AaAb|BbBa
A-> ϵ
B-> ϵ
Is LL(1) and parse the input string “ba”.
4 Consider the following grammar: E-> E+T|T L3 CO2
T-> TF|F
F-> F*|a|b
Construct the SLR parsing table and also parse the input “a*b+a
5 Write a short note on: L1 CO2
1. Augmented grammar
2. Kernel items
3. Rules of closure operation and goto operation
4. Rules to construct the LR(0) items
6 Write the comparison among SLR Parser, LALR parser and Canonical L2 CO2
LR Parser.
7 Show the following grammar L3 CO2
S->Aa|bAc|Bc|bBa
A->d
B->d
Is LR(1) but not LALR(1).
8 What is LALR parser? Construct the set of LR(1) items for this L3 CO2
grammar: S-> CC
C-> aC
C->d
9 Consider the following grammar: L3 CO2
S-> Aa|bAc|Bc|bBa
A-> d
B-> d
Compute closure and goto.
10 Consider the grammar: E-> E+E L3 CO2
E-> E*E
E->id
Perform shift reduce parsing of the input string “id1+id2+id3”.
11 Derivation and Parse Tree: L3 CO1
Let G be a Context Free Grammar for which the production Rules are
given below:
S -> aB|bA
A -> a|aS|bAA
B -> b|bS|aBB
Drive the string aaabbabbba using the above grammar (using Left
Most Derivation and Right most Derivation).