0% found this document useful (0 votes)
37 views5 pages

CD Question Bank

Compiler Design Question Bank

Uploaded by

Rucha Gavas
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)
37 views5 pages

CD Question Bank

Compiler Design Question Bank

Uploaded by

Rucha Gavas
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/ 5

Compiler Design

Question Bank

Unit 1
1. What is Compiler? Design the Analysis and Synthesis Model of Compiler.
2. Write down the five properties of compiler.
3. What is translator? Write down the steps to execute a program.
4. Explain the phases of compiler with block diagram.
5. Define the compiler. Explain the phases of compiler.
6. Write a short note on:
● YACC
● Pass
● Bootstrapping
● LEX Compiler
● Tokens, Patterns and Lexemes
7. Define following tools :
● Compiler
● Interpreter
● Assembler
● Translator
● Linker & Loader
8. Draw diagram for language processing system and explain.
9. Explain compiler construction tools with example.
Unit 2
1. Define token, pattern and lexeme with suitable example. How input
buffering can be implemented for scanner, Explain.
2. Explain about design of lexical analyzer generator with its suitable
diagram.
3. What is Regular Expression? Write the regular expression for:
● R=R1+R2 (Union operation)
● R=R1.R2 (concatenation Operation)
● R=R1* (Kleen Clouser)
● R=R+ (Positive Clouser)
4. Write a regular expression for a language containing strings which end
with “abb” over Ʃ= {a, b}.
5. Construct a regular expression for the language containing all strings
having any number of a’s and b’s except the null string.
6. Construct Deterministic Finite Automata to accept the regular
expression : (0+1)* (00+11) (0+1)*
7. Derivation and Parse Tree:
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).
8. Convert the following Non-Deterministic Finite Automata (NFA) to
Deterministic Finite Automata (DFA).
Unit 3

1. Explain the parsing techniques with a hierarchical diagram.


2. Write Rules to construct FIRST Function and FOLLOW Function.
Find First and Follow for given grammar
S-> XS | dS | ε
X -> Y | Zb | aY
Y ->cZ
Z-> e
3. What are the problems associated with Top Down Parsing?
4. Write the production rules to eliminate the left recursion and left
factoring problems.
5. Consider the following Grammar:
A-> ABd|Aa|a
B-> Be|b
Remove left recursion.
6. Do left factoring in the following grammar:
A-> aAB|aA|a
B-> bB|b
7. Write a short note on:
i. Ambiguity (with example)
ii. Recursive Descent Parser
iii. Predictive LL(1) parser (working)
iv. Handle pruning
v. Operator Precedence Parser
8. Write Rules to construct FIRST Function and FOLLOW Function.
Consider Grammar:
E-> E+T|T
T-> T*F|F
F-> (E)|id
Unit 4
1. Write the three address statement with example for:
a. Assignment
b. Unconditional jump (goto)
c. Array statement (2D and 3D)
d. Boolean expression
e. If-then-else statement
f. While, do-while statement
g. Switch case statement
2. Write quadruples, triples and indirect triples for the expression:
(a * b) + (c + d) - (a + b + c + d)
3. Construct syntax tree and postfix notation for the following expression:
a + (b * c) – e * (f + g)
4. Draw the syntax tree and DAG for the following expression:
(a * b) + (c - d) * (a * b) + b
5. What are intermediate code and Explain types of representation of
Intermediate code?
6. What are advantages and disadvantages of Intermediate code and Three
address code
Unit 5
1. Explain S-attributed Grammer & L-attributed grammer with example?
2. Explain syntax directed definition with simple examples?
3. Explain Synthesized and Inherited attributes.
4. Write syntax directed definitions to construct syntax tree and three
address code for assignment statements.
5. Difference between SDD abd SDT.

Unit 6
1. What is code optimization? Explain machine dependent and
independent code optimization.
2. What is common sub-expression and how to eliminate it? Explain with
example.
3. Write a short note with example to optimize the code:
a. Dead code elimination
b. Variable elimination
c. Code motion
d. Reduction in strength
4. What is control and data flow analysis? Explain with example.
5. What are the properties of code generation phase? Also explain the
Design Issues of this phase.

You might also like