CD Question Bank
CD Question Bank
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?