0% found this document useful (0 votes)
62 views3 pages

CD Question Bank

The document discusses compiler design and contains questions related to the different phases, components, and techniques involved in compiling a program. This includes topics like lexical analysis, syntax analysis, intermediate code generation, code optimization, symbol tables and more. A total of 42 questions are provided with varying difficulty levels.

Uploaded by

Bipin Bhadra
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)
62 views3 pages

CD Question Bank

The document discusses compiler design and contains questions related to the different phases, components, and techniques involved in compiling a program. This includes topics like lexical analysis, syntax analysis, intermediate code generation, code optimization, symbol tables and more. A total of 42 questions are provided with varying difficulty levels.

Uploaded by

Bipin Bhadra
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/ 3

Compiler Design

Bit Ques ons


1. What are the Components of a Language processing system?
2. What do you mean by cross-compiler?
3. What is the front end and back end of a compiler?
4. Design an NFA with ∑ = {0, 1} accepts all string ending with 01
5. Design an NFA in which all the strings contain a substring 1110.
6. Design the NFA for Integer numbers representation.
7. What is an operator grammar? Give an Example.
8. S → SAS | a, A → bSb | b
The above-given grammar is an operator grammar or not? Justify your Answer.
9. What are the different actions performed by the S-R parser?
10. Eliminate left recursion from the following grammar:
1) E → E + T | T 2) T → T * F | F
11. Consider the following grammar and eliminate the left recursion
A → ABd | Aa | a, B → Be | b
12. Eliminate left factoring in the following grammar
S → iEtS | iEtSeS | a
E→b
13. Consider the following LR (0) grammar. What is the problem?
S → W b ,W → a, W → X a, X → a
14. What kinds of conflicts may arise during the construction of the LR (0) parsing table?
15. Consider the following LR (0) grammar. What is the problem?
S→WW
W→a
W → ab
16. What do you mean by syntax-directed translation?
17. What is the relation between L-attributed SDT and S-attributed SDT?
18. What do you mean by syntax-directed definition?
19. What are the different functions of an Error handler?
20. What are the different types of errors encountered during the compilation of a
Program?
21. What are the different error recovery strategies in compiler design?
22. What are the different forms of three address code representations?
23. What are the different forms of Intermediate code representation?
24. What are the benefits of using intermediate code generation over direct code
generation?
25. Consider the following expression and construct a DAG for it. (a + b) * (a + b + c)
26. Draw the DAG for the following Instruction. A: = B * -C + B * -C
27. Consider the following expression and construct a DAG for it. ((a + a) + (a + a))
28. What are the techniques used for loop optimization?
29. What are the Characteristics of peephole optimisation?
30. What are the objectives of peephole optimization?
Long Ques ons
1. Explain the different phases of the compiler with a neat diagram.
2. Illustrate the action taken by various phases of the compiler on the following source
program instruction during compilation. X=A+B*5
3. Explain the different steps involved in the Language Processing System
4. Test whether the given grammar is LL (1) or not and construct a predictive parsing
table for it.
S → iCtSS' | a
S'→ eS | ε
C→b
5. Justify whether the given grammar is LL (1) or not and construct a predictive parsing
table for it. S → AaAb | BbBa, A → ε, B→ε
6. Justify whether the given grammar is LL (1) or not and construct a predictive parsing
table. S → aBa, B → bB | ε
7. Differentiate between the Complier & Interpreter.
8. Differentiate between the Linker and loader.
9. What are the features and types of Compilers?
10. Convert the given NFA to DFA.

11. Convert the given NFA to DFA.

12. What are the steps required for converting NFA to DFA? What is the procedure for
converting regular expression into minimized DFA?
13. Consider the following grammar and construct a Parse Tree for the string
2 * ( 5 + 3 ) / 4 using Left Most Derivation.
E -> E A E, E -> ( E ), E -> id, A -> + | - | * | / | ^
14. Differentiate between ambiguous grammar and unambiguous grammar
15. Consider the following grammar and construct a Parse Tree for the string
2 * ( 5 + 3 ) / 4 using Right Most Derivation.
E -> E A E, E -> ( E ), E -> id, A -> + | - | * | / | ^
16. Consider the following grammar and compute all non-terminal symbols' FIRST() and
FOLLOW(). E → E + T | T, T → T * F | F, F → (E) | id
17. Consider the following grammar and compute FIRST() and FOLLOW() of all non-
terminal symbols.
S → ACB | CbB | Ba, A → da | BC, B → g | Ɛ, C→h|Ɛ
18. Consider the following grammar and compute all non-terminal symbols' FIRST() and
FOLLOW(). S → B c | D B, B → a b | c S, D→d|Ɛ
19. Check the following grammar is LR (1) or not?
S → CC, C → cC | b
20. Construct the CLR (1) parsing table for the following grammar:
S→ AA , A→aA, A→b
21. Construct the SLR (1) parsing table for the following grammar:
E → E+T | T, T → T*F | F, F → (E) | id
22. What are the rules for forming Operator-Precedence Relations from Precedence and
Associativity of Binary Operators?
23. Differentiate between Synthesized Attributes and Inherited Attributes
24. Explain the different components of the operator precedence parser.
25. What do you mean by LR (1) items? How it is different from LR (0) items?
26. Construct the LR (1) items for the following grammar
S → CC, C → cC, C→d
27. What is the purpose of LR (1) items? Explain briefly with an example.
28. Construct the CLR parsing table for the following grammar:
S→ AA A→aA, A→b
29. How LALR (1) parsing is different from the CLR (1) and SLR (1) parsing?
30. Differentiate between Synthesized Attributes and Inherited Attributes
31. What are the basic operations defined on a symbol table? Explain briefly.
32. What are the different ways to implement the Symbol Table in the Compiler?
33. What is the role of a Symbol Table in the Compiler?
34. Write the quadruples and triples for the following given expression.
(x + y) * (y + z) + (x + y + z)
35. Write the quadruples and triples for the following given Expressions:
x[i]: = y, x: = y[i]
36. Write the quadruples and triples for the following given Expressions: a: = -
b * (c + d)
37. What are the objectives of Code Optimization? Explain the different types of loop
optimization.
38. What is an activation Record? Explain Clearly the components of an activation
record.
39. Where to apply Optimization? What are the different Phases of Optimization?
40. What are the purposes for the use of DAG and What are the rules used for the
construction of the DAG?
41. Differentiate between Machine Independent Code Optimization and Machine
Dependent Code Optimization.
42. What are the rules for any given code that can be partitioned into basic blocks?

You might also like