SITARAMBHAI NARANJI PATEL
INSTITUTE OF TECHNOLOGY AND RESEARCH CENTRE, UMRAKH
Computer Science and Engineering Department
Compiler Design (2170701)
Unit- w is e Qu es tio ns ( So l ved - Unso l ved )
Unit – 1 Introduction
1 Explain overview of translation process.
2 What is compiler? List major functions done by compiler
3 Write difference between compiler, interpreter and assembler. [W17-3M]
or Differentiate compilers and interpreters. [S19-4M]
4 Explain analysis-synthesis model of compilation. List Factors that affect the design of [W19,S12-6M]
compiler. Also list major functions done by compiler.
or Explain structure of compiler. Also explain analysis phase in brief. [S13-7M]
or List out phases of compiler. Write a brief note on lexical analyzer. [S14-6M]
or Explain various phases of compiler with example. [S17, S16- 7M]
or Describe all phases of compiler [S15,S16, W16-7M ]
or Write output of phases of compiler for a=a+b*c*2; type of a,,b,c are float. [W12-7M]
or Write output of phases of compiler for total=count + rate*10; type of rate is float.
or Explain analysis of source program for compilers. [S19,W17-7M]
5 Explain context of compiler.
or Explain cousins of compiler.
or List the cousins of compiler and explain the role of any one of them. [W18- 3M]
or What does loader, linker and preprocessor do? Explain their roles in compilation
process.
or Explain loader and linker. [W16- 3.5M]
6 Explain front end and backend of compiler in detail. [W18- 7M]
7 What is the pass of compiler? Explain how the single and multi-pass compilers work? [S14-7M]
or What is the pass of compiler? What is the effect of reducing the number of passes? [W11-4M,W17-3M]
8 Explain types of compiler.
or Write difference between single pass and multi-pass compiler.
9 Write difference between phases and pass.
10 Explain symbol table with two data structures suitable for it. [S17- 7M]
or What is symbol table? Discuss the most suitable data structure for it by stating [W16- 3.5M]
merits/ demerits.
or Write a short note on Symbol Table management. [W15-7M]
Unit – 2 Lexical Analysis
Q1: Explain role of lexical analysis and its issues in compilation.
OR
How do parser and scanner communicate? Explain with the block diagram of communication between them.
Course instructor: Prof. Rutal Mahajan CD-2170701 Page 1
SITARAMBHAI NARANJI PATEL
INSTITUTE OF TECHNOLOGY AND RESEARCH CENTRE, UMRAKH
Computer Science and Engineering Department
Compiler Design (2170701)
Unit- w is e Qu es tio ns ( So l ved - Unso l ved )
Q2: Explain token, pattern and lexemes.
OR
Define token, patterns and lexeme. Identify the lexemes that makes up tokens in the following program
segment. Indicate corresponding token and pattern. [W15- 7M]
void swap (int a, int b)
{
int k;
k=a;
a=b;
b=k;
}
Q3: What is input buffering? Explain technique of buffer pair.
OR
Which technique is used for the speeding up the lexical analyzer?
OR
Explain input buffering methods. [Summer 17 – 7M]
write a brief note on input buffering methods [winter 18-4M]
Q4: what is regular expression and regular definition? Why it is important for lexical analysis?
OR
What is regular expression, give all the algebraic properties of regular expression. [S16-7M]
Q5: write a regular expression for the
(i) 0 or 1
(ii) 0 or 11 or 111
(iii) Regular expression over Σ = {a, b, c} that represents all string of length 3
(iv) String having 0 or more a
(v) String having one or more a
(vi) All binary string
(vii) 0 or more occurrences of either a or b or both
(viii) 1 or more occurrences of either a or b or both
(ix) Binary no. end with 0
(x) Binary no. end with 1
(xi) Binary no. starts and end with 1
Course instructor: Prof. Rutal Mahajan CD-2170701 Page 2
SITARAMBHAI NARANJI PATEL
INSTITUTE OF TECHNOLOGY AND RESEARCH CENTRE, UMRAKH
Computer Science and Engineering Department
Compiler Design (2170701)
Unit- w is e Qu es tio ns ( So l ved - Unso l ved )
(xii) String starts and ends with same character
(xiii) All string of a and b starting with a
(xiv) String of 0 and 1 ends with 00
(xv) All binary string with at least 3 characters and 3 rd character should be 0.
(xvi) Language which consists of exactly two b’s over the set Σ = {a,b}
(xvii) Language of C identifiers
Q6: Explain finite automata. (NFA & DFA)
Q7: Convert from NFA to DFA using Thompson’s rule. (a+b)* abb
Q8: Construct the NFA for following regular expression using Thompson’s notations and then convert it to
DFA.
a( b | c)* a* c# [W16- 7M]
Q9: Construct DFA without constructing NFA for following regular expression
1) a*b*a(a|b)*b*a#
minimize the same [W16- 7M]
2) (a+b)*abb#
OR
Convert the (a | b | c)*d*(a* | b)ac+# regular expression to DFA directly and draw its DFA. [S16-7M]
OR
Constructing DFA for following regular expression. Use firstpos, lastpos and followpos function to
construct DFA. (a* | b*) * [W15-7M]
Q10: Explain subset construction method with an example. [S 17 -7M]
Q11: Construct a DFA without constructing NFA for following regular expression.
1) (a | b)* a [S17-7M]
Q12: Draw the DFA for the regular expression (a | b)*abb using set construction method only. [S16- 7M]
Q13: Write short note on context free grammar (CFG) explain it using suitable example. [S16-7M]
Q14: Unsigned numbers are strings such as 5280, 39.37, 6.336E4 or 1.894E-4, give the regular definition for
above mentioned strings. [S16-7M]
Q15: Draw the state transition diagram for the unsigned numbers. [S16-7M]
Course instructor: Prof. Rutal Mahajan CD-2170701 Page 3
SITARAMBHAI NARANJI PATEL
INSTITUTE OF TECHNOLOGY AND RESEARCH CENTRE, UMRAKH
Computer Science and Engineering Department
Compiler Design (2170701)
Unit- w is e Qu es tio ns ( So l ved - Unso l ved )
Course instructor: Prof. Rutal Mahajan CD-2170701 Page 4