0% found this document useful (0 votes)
71 views7 pages

Ahmedabad Institute of Technology: Compiler Design (2120701)

This document contains the vision, mission, and question bank for the Compiler Design course offered by the Computer Engineering Department at Ahmedabad Institute of Technology for the academic year 2020-2021. The question bank was prepared by Prof. Neha Prajapati and contains 18 multiple choice and short answer questions covering 3 units of the course - Compiler Structure, Lexical Analysis, and Syntax Analysis.

Uploaded by

Dhairya Maradiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views7 pages

Ahmedabad Institute of Technology: Compiler Design (2120701)

This document contains the vision, mission, and question bank for the Compiler Design course offered by the Computer Engineering Department at Ahmedabad Institute of Technology for the academic year 2020-2021. The question bank was prepared by Prof. Neha Prajapati and contains 18 multiple choice and short answer questions covering 3 units of the course - Compiler Structure, Lexical Analysis, and Syntax Analysis.

Uploaded by

Dhairya Maradiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Ahmedabad Institute of Technology

CE Department
Compiler Design (2120701)
Question Bank
Year: 2020-2021

Prepared By: - Prof. Neha Prajapati


CE Department Vision:
To   produce   technically   sound   and   ethically   responsible   Computer   Engineers   to   the   society   by
                          
providing Quality Education.

CE Department Mission:
1) To provide healthy Learning Environment based on current and future Industrial demands.
2) To   promote   curricular,   co­curricular   and   extra­curricular   activities   for   overall   personality
development of the students.
3) To   groom   technically   powerful   and   ethically   dominant   engineers   having   real   life   problem
solving capabilities.
4) To provide platform for Effective Teaching Learning. 

IT Department Vision:
To provide quality education and assistance to the students through innovative teaching learning
methodology for shaping young mind technically sound and ethically strong.

IT Department Mission:
1) To serve society by producing technically and ethically sound engineers.
2) To   generate   groomed   and   efficient   problem   solvers   as   per   Industrial   needs   by   adopting
innovative teaching learning methods.
3) To emphasis on overall development of the students through various curricular, co­curricular
and extra­curricular activities.
UNIT 1
Sr. Question Paper Date Marks
No.
1 What is the difference between compiler and interpreter? 02/11/2017 3
2 Explain analysis phase of the source program with example 02/11/2017 4
3 What is a pass in a compiler? What is the effect of reducing the 02/11/2017 3
number of passes?
4 Explain buffer pairs and sentinels. 02/11/2017 4
5 Translate the arithmetic expression a*-(b+c) into 1. Syntax tree 2. 02/11/2017 3
Postfix notation 3. Three address code
6 List the cousins of compiler and explain the role of any one of 15/11/2018 3
them.
7 Write a brief note on input buffering techniques. 15/11/2018 4
28/04/2018
08/05/2018
03/12/2018
8 Explain front end and back end of compiler in detail. 15/11/2018 7
9 Define cross compiler, token and handle. 28/04/2018 3
10 Explain phases of compiler with example. 28/04/2018 7
29/04/2017
03/12/2018
11 What is symbol table? For what purpose , compiler uses symbol 28/04/2018 3
table? 29/04/2017 7
12 Explain various data structures used in symbol table management. 08/05/2018 7
Unit -2
1 Write an algorithm for Thompson’s construction method. Apply the 02/11/2017 7
algorithm to construct NFA for following regular expression. (a |
b)*abb.
2 What is operator grammar? Generate precedence function table for 02/11/2017 7
following grammar.
E -> EAE | id
A -> + | *
3 Explain role of lexical analyzer 02/11/2017 4
4 Construct NFA for following regular expression using Thompson’s 15/11/2018 7
notation and then convert it into DFA. (a/b)*abb# 08/05/2018
5 Draw transition diagram for relational operators. 28/04/2018 4
6 Explain subset construction method with example. 28/04/2018 7
03/12/2018

Page 2 of 7
Prepared By: Prof. Neha Prajapati CD 2120701
7 Draw DFA for the following regular expression using firstpos( ), 28/04/2018 7
lastpos ( ) and followpos ( ) functions. ( a | b) * a
8 Construct DFA for following regular expression without constructing 08/05/2018 7
NFA and
optimize the same.
( a | ε )* a b ( a | b )* #
9 Construct a DFA without constructing NFA for the following regular 03/12/2018 7
expression.
a(a | b )*ab
Unit 3
1 Define handle and handle pruning. Explain the stack implementation 02/11/2017 7
of shift reduce parser with the help of example. 03/12/2018
08/05/2018
2 Give the translation scheme that converts infix to postfix notation. 02/11/2017 3
Generate the annotated parse tree for input string 3-5+4. 28/04/2018 7
08/05/2018
3 Check given grammar is LL(1) but not SLR(1). 02/11/2017 7
S -> AaAb | BbBa 29/04/2017
A -> € 03/12/2018
B -> €
4 What is left factoring and left recursion? Explain it with suitable 02/11/2017 7
example. 29/04/2017
03/12/2018
5 Define syntax tree. What is s-attributed definition? Explain 02/11/2017 7
construction of syntax tree for the expression a-4+c using SD 08/05/2018
6 Explain parameter passing techniques for procedure. 02/11/2017 3
15/11/2018 4
28/04/2018 4
03/12/2018
7 Construct LL(1) parsing table for the following Grammar: 15/11/2018 7
E -> E+T | T 29/04/2017
T -> T*F | F 08/05/2018
F -> (E) | a 03/12/2018
OR
Check following grammar is LL (1) or not?
S -> aB | €
B -> bC | €
C -> cS | €
or
S -> aAC | bB
A -> Abc | Abd | e
B -> f | g

Page 3 of 7
Prepared By: Prof. Neha Prajapati CD 2120701
C -> h |i
or
S → iEtS | iEtSeS | a
E→ b
8 Define the following terms and give suitable example for it. 15/11/2018 3
1) Augmented Grammar 2) LR(0) Item 3) LR(1) Item
9 Differentiate Top Down Parsing and Bottom up parsing 15/11/2018 4
10 Construct SLR parsing table for the following grammar : 15/11/2018 7
S ->(L)|a 28/04/2018
L->L,S|S 08/05/2018
or
S -> aAb | bB
A -> Aa | ε
B -> Bb |ε
11 Give the difference between SLR and CLR Parser. 15/11/2018 3
12 List the different conflicts that occur in Bottom up parsing and give 15/11/2018 4
examples for that.
13 Implement the following grammar using Recursive Descent Parser. 15/11/2018 7
S -> Aa | bAc | bBa
A -> d
B -> d
14 What is Ambiguous Grammar? Describe with example. 15/11/2018 3
15 Give the difference between synthesized attributes and inherited 15/11/2018 4
attributes 28/04/2018
16 Construct CLR parsing table for the following grammar : 15/11/2018 7
S ->AA 28/04/2018
A->aA|b 29/04/2017
or
S -> aSA | €
A -> bS | c
17 Give the translation scheme that converts infix to postfix expression 15/11/2018 4
for the following grammar and also generate the annotated parse tree 03/12/2018
for input string “id+id*id”
E -> E+T | T
T -> T*F | F
F -> id
18 What is operator grammar? Check the following grammar is 28/04/2018 4
operator or not. Justify your answer. 29/04/2017
E-> EOE 03/12/2018
E-> id
O-> * | + | -
OR

Page 4 of 7
Prepared By: Prof. Neha Prajapati CD 2120701
Define operator precedence grammar. Construct precedence matrix and
precedence graph for arithmetic grammar as shown below:
E -> E + T | T
T -> T * F | F
F -> (E) | id
19 Check the following grammar is left recursive or not. Justify your 28/04/2018 4
answer. If Left recursive then make grammar as non-left recursive.
S-> ( L ) | a
L-> L , S | S
20 Consider the following grammar and construct the corresponding 28/04/2018 3
left most and right most derivations for the sentence abab.
SaSbS | bSaS | ε
21 Find out FIRST and FOLLOW for the following grammar. 28/04/2018 4
S->1AB | ε
A-> 1AC | 0C
B-> 0S
C-> 1
22 Develop a syntax directed definition for following grammar. 29/04/2017 7
E -> TE’
E’ -> +TE’ | €
T -> ( E )
T -> id
23 Construct the LALR parsing table for the following grammar. 08/05/2018 7
S -> CC
C -> aC
C -> d
24 Explain Operator precedence Parsing technique in detail. 08/05/2018 7
25 Explain working of non-Recursive Predictive Parser with diagram. 03/12/2018 7
26 What do you mean by ambiguous grammar? Show that following is an 03/12/2018 7
ambiguous grammar.
E→E+E | E*E | E-E | E/E | (E) | id
Unit 4
1 Explain error recovery strategies used by parser. 02/11/2017 4
15/11/2018 7
08/05/2018
2 Explain panic mode recovery strategy 28/04/2018 4
Unit 5
1 Write Syntax Directed Definition to produce three address code for the 02/11/2017 4
expression containing the operators := , + , - (unary minus), ( ) and id.
2 What is importance of intermediate code? Discuss various 02/11/2017 7
representations of three address code using the given expression. a = b 29/04/2017

Page 5 of 7
Prepared By: Prof. Neha Prajapati CD 2120701
* -c + b * -c . or 08/05/2018
a + a * (b- c) + (b – c) * d. 03/12/2018
3 Explain Quadruple, triple and indirect triple with suitable example 15/11/2018 7
28/04/2018
29/04/2017
4 What is intermediate code? Explain different types of intermediate 08/05/2018 7
coderepresentations. Also discuss importance of intermediate code.
Unit 6
1 What is activation record? Explain stack allocation of activation 02/11/2017 7
records using example. 15/11/2018 3
28/04/2018
29/04/2017
2 What is activation tree? 02/11/2017 3
29/04/2017 7
3 What is an activation record? Explain how they are used to access local 15/11/2018 7
and global variables. 28/04/2018
29/04/2017
4 Explain activation tree, control stack, the Scope of Declaration and 08/05/2018 7
Bindings of Names.
Unit 7
1 Explain three loop optimization techniques with example. 02/11/2017 3
15/11/2018 7
28/04/2018
2 What is code optimization? Explain data flow equation. 02/11/2017 4
03/12/2018
3 Explain any three code optimization methods 29/04/2017 7
Unit 8
1 Describe code generator design issues. 02/11/2017 4
28/04/2018
29/04/2017
03/12/2018
2 Define following : DAG, Basic Blocks, Flow graph 02/11/2017 7
29/04/2017
3 Explain peephole optimization 02/11/2017 4
28/04/2018
29/04/2017
08/05/2018
4 List the different issues in code generation phase and describe any two 15/11/2018 3
issue

Page 6 of 7
Prepared By: Prof. Neha Prajapati CD 2120701
5 Draw syntax tree and DAG for the statement 15/11/2018 3
x=(a+b)*(a+b+c)*(a+b+c+d) 28/04/2018 4
Draw a DAG for expression: a + a * (b – c) + (b – c) * d. 29/04/2017 4
Or 08/05/2018 4
d: = b * c
e: = a + b
b: = b * c
a: = e – d
6 Explain dynamic memory allocation strategy. OR 15/11/2018 4
Compare: Static v/s Dynamic Memory Allocation. 28/04/2018 4
7 Write difference(s) between stack and heap memory allocation 28/04/2018 3
8 Write a grammar to declare variables with data type int or float or char. 29/04/2017 7
Also develop a syntax directed definition for that. Draw the
dependency graph for same
9 Discuss various Storage allocation strategies in detail. 08/05/2018 7

Page 7 of 7
Prepared By: Prof. Neha Prajapati CD 2120701

You might also like