Professional Documents
Culture Documents
Question Bank
Question Bank
Question Bank
1) What is a language processor? What are the various types of language processors?
2) What is a compiler? What are the activities performed by the compiler?
3) What is an interpreter? What are the differences between a compiler and interpreter 4)
What is an assembler? What are the activities performed by the compiler?
5) What is hybrid compiler?
6) What are the cousins of the compiler? or Explain language processing system
7) Discuss the analysis of source program with respect to compilation process
8) What are the different phases of the compiler? or “Explain the block diagram of the
compiler construction method
9) Show the output of each phase of the compiler for the assignment statement: sum =
initial + value * 10
10) What is the difference between a phase and pass? What is a multi-pass compiler? Explain
the need for multiple passes in compiler?
13) Why analysis portion of the compiler is separated into lexical analysis and syntax
analysis phase?
16) Identify lexemes and tokens in the following statement: printf(“Simple Interest = %f\n”,
si);
17) What is the need for returning attributes for tokens along with token name?”
Module 2
1) What is a context free grammar? What is derivation? What are the two types of
derivations?
4) Define the terms: Language, derivation tree, yield of a tree, ambiguous grammar
5) Show that the following grammar is ambiguous
E→E+E
E→E-E
E→E*E
E→E/E
E → (E) | I
I → id
7) What is dangling else problem ? How dangling else problem can be solved
S → iCtS | iCtSeS | a
C→b
9) Convert the following ambiguous grammar into unambiguous grammar using normal
precedence and associativity of the operators
E→E*E|E-E
E→E^E|E/E
E→E+E
E → (E) | id
by considering * and – operators lowest priority and they are left associative, / and +
operators have the highest priority and are right associative and ^ operator has
precedence in between and it is left associative.
13) What is top down parser? Show the top-down parsing process for the string id + id * id
for the grammar
i. E → E + E
ii. E → E * E
iii. E → (E)
iv. E → id
14) What is recursive descent parser? Write the algorithm for recursive descent parser
15) Write the recursive descent parser for the following grammar
E→T
T→F
F → (E) | id
16) What are the different types of recursive descent parsers? What is the need for
backtracking in recursive descent parser
17) Show the steps involved in recursive descent parser with backtracking for the input string
cad for the following grammar
S → cAd A →
ab | a
18) For what type of grammars recursive descent parser cannot be constructed? What is the
solution?
19) What is left recursion? What problems are encountered if a recursive descent parser is
constructed for a grammar having left recursion?
22) Write the recursive descent parser for the following grammar:
E → TE1
E1→ +TE1 | ϵ
T → FT1 T1→
*FT1 | ϵ
F → (E) | id
23) Obtain top-down parse for the string id+id*id for the following grammar E → TE1
E1 → + TE1 |
T → FT1
T1 → *FT1 |
F → (E) | id
26) What is left factoring? What is the need for left factoring? How to do left factoring?
Write the algorithm for doing left-factoring
S → iCtS | iCtSeS | a
C →b
30) What are the various components of predictive parser? How it works?
31) Define FIRST and FOLLOW sets and write the rules to compute FIRST and FOLLOW
sets
33) What is LL (1) grammar? How to check whether a given grammar is LL(1) or not
without constructing the predictive parser
34) Compute FIRST and FOLLOW symbols and predictive parsing table for the following
grammar and check whether the grammar is LL(1) or not.
S → iCtS | iCtSeS | a
C→ b
38) Left factor the following grammar and obtain LL(1) parsing table
E→T+E|T
T → float | float * T | (E)
Module 4
1) With a neat diagram, explain variants of Turing Machines.
2) Explain Language Acceptability and Design of Turing Machines.
3) Define Turing Machine Model. Explain the representation of Turing Machines.
4) Explain the Model of Linear bound Automation.
5) Explain the following with example, i) Decidability ii) Decidable languages iii)
Undecidable languages.
6) Discuss Halting problem and post correspondence problem with respect to TM.
7) Write Short notes on i) Growth rate of Function ii) Classes of P and NP iii) Quantum
Computers iv) Church Turing Thesis
Module 5
1) How to construct semantic rules that help us to create syntax trees for the
expressions?
2) Obtain the semantic rules to construct a syntax tree for simple arithmetic expressions
using bottom up approach
3) Create a syntax tree for the expression “a – 4 + c”
4) Obtain the semantic rules to construct a syntax tree for simple arithmetic expressions
using top-down approach with operators + and –
5) Obtain the semantic rules to construct a syntax tree for simple arithmetic expressions
with operators -, +, * and / using top-down approach
6) Give the syntax directed translation of type int [2][3] and also given the semantic
rules for the respective productions
7) What is syntax directed translation scheme
8) What is Postfix Syntax-directed-translation or Postfix SDT
9) Obtain Postfix SDT implementation of the desk calculator to evaluate the given
expression
10) Write the SDD and annotate parse tree for converting an infix to postfix expression
11) Write the SDT for converting an infix to postfix expression. Show the actions for
translating the expression 2*3+4 into its equivalent postfix expression
12) Explain parser-stack implementation of Postfix SDT‟s
13) Write the actions of desk calculator SDT so that they manipulate the parser
explicitly
14) When action part specified in the production is executed
15) Write the SDT for converting an infix to prefix expression. Show the actions for
translating the expression 2*3+4 into its equivalent prefix expression