Question Bank CD
Question Bank CD
DEPARTMENT : CSE
SEMESTER : 5
(Signature with Name and date) (Signature with Name and date) (Signature with Name and date)
IQAC COORDINATOR
UNIT II
PART A
Blooms Level
Q. No. Questions CO (BTL1/BTL2)
1. Define phrase-level error recovery. CO2 BTL1
2. Illustrate the algorithms for FIRST and FOLLOW with examples. CO2 BTL2
3. Recall the error recovery techniques used in predictive parsing. CO2 BTL1
4. Interpret the concept of operator precedence grammar. CO2 BTL2
5. Define augmented grammar. CO2 BTL1
6. Compare and contrast LR parsers with LL parsers. CO2 BTL2
7. Define dead code elimination. CO2 BTL1
8. Explain the types of LR parsers with examples. CO2 BTL2
9. Identify the steps involved in the bottom-up parsing method. CO2 BTL1
10. Explain ambiguous grammar. CO2 BTL2
PART B
Blooms Level
Q. No. Questions CO (BTL3 to BTL6)
11. Demonstrate the parsing techniques using a hierarchical diagram. CO2 BTL3
12. Differentiate between various problems associated with Top-Down Parsing. CO2 BTL4
13. Assess the given production rules and recommend modifications to eliminate CO2
left recursion and left factoring problems. BTL5
14. Compose an explanation for the following concepts with practical examples: CO2
a. Ambiguity (with example)
b. Recursive Descent Parser
c. Predictive LL(1) Parser BTL6
d. Handle pruning
e. Operator Precedence Parser
15. Execute the rules to construct the FIRST and FOLLOW functions. CO2 BTL3
16. Categorize the steps needed to analyze the given grammar and identify CO2 BTL4
17. conflicts
Prioritizeinsteps
parsing.
in constructing a Predictive Parsing Table and decide how to CO2 BTL5
handle conflicting cases.
18. Invent a new approach for performing shift-reduce parsing of "id1+id2+id3" CO2
and analyze its efficiency under the given grammar.
E -> E+E BTL6
E -> E*E
E -> id
19. Demonstrate the properties of an LR parser with its structure and use the CO2
techniques of LR parsing to parse a given input. BTL3
20. Investigate the following concepts in LR parsing: CO2
a. Augmented grammar and its role in parsing
b. Kernel items and their significance BTL4
c. Rules governing closure and goto operations
d. Construction process of LR(0) items with an analytical example
PART C
Blooms Level
Q. No. Questions CO (BTL3 to BTL6)
21. Apply the closure and goto operations to the given grammar. CO2 BTL3
22. Construct the rules for building the SLR parsing table. CO2 BTL3
Demonstrate your understanding of the LALR parser by constructing the set
of LR(1) items for the grammar:
23. S → CC CO2 BTL3
C → aC
C→d
Analyze and compare the differences between SLR Parser, LALR parser, and CO2
24. Canonical LR Parser. BTL3
UNIT III
PART A
Blooms Level
Q. No. Questions CO (BTL1/BTL2)
1. Define type equivalence. CO3 BTL1
2. Discuss the role of an intermediate code generator in the compilation process. CO3 BTL2
3. Define leftmost derivation and rightmost derivation with examples. CO3 BTL1
4. Describe the various types of intermediate code representation. CO3 BTL2
5. What is a simple type checker? Write a note on its specification. CO3 BTL1
6. Explain the purpose and types of intermediate code representations. CO3 BTL2
7. Define type expression with an example. CO3 BTL1
8. Explain the general structure of an activation record. CO3 BTL2
9. What are type expressions and type systems? CO3 BTL1
10. Define syntax tree. CO3 BTL1
PART B
Blooms Level
Q. No. Questions CO (BTL3 to BTL6)
11. Evaluate the significance of Syntax-Directed Definitions (SDD) in enabling CO3
semantic analysis during compilation BTL5
12. Design the syntax tree and Directed Acyclic Graph (DAG) for the following CO3 BTL6
expression: (a∗b)+(c−d)∗(a∗b)+b
13. Differentiate between synthesized translation and inherited translation, and CO3
analyze their use cases in compiler design. BTL4
14. Demonstrate the concept of intermediate code generation and explain its two CO3
benefits with relevant scenarios. BTL3
15. Assess the significance of the following concepts in compiler optimization: CO3 BTL5
a. Abstract Syntax Tree (AST)
b. Polish Notation
c. Three Address Code
d. Backpatching
16. Construct the syntax tree and derive the postfix notation for the expression: CO3 BTL3
(a + (b * c) ^ d - e / (f + g))
17. Generate quadruples, triples, and indirect triples for the expression: CO3 BTL3
-(a * b) + (c + d) - (a + b + c + d)
18. Design a grammar using S-attribute definitions for a simple programming CO3 BTL6
language feature and implement a syntax-directed definition for it.
19. Formulate a detailed explanation of type checking by creating your own CO3 BTL6
example expression and demonstrating the type validation process step-by-
step.
20. Explain in detail about predictive Translator with an example CO3 BTL5
PART C
Blooms Level
Q. No. Questions CO (BTL3 to BTL6)
Explain and demonstrate the specification of a type-checking system using CO3 BTL3
21. examples.
Examine intermediate languages with examples and analyze their role in CO3 BTL4
22. compiler design.
Evaluate the role of syntax-directed definitions and annotated parse trees in CO3 BTL5
23. simplifying expression evaluation for a desk calculator.
Write short notes and use examples to explain: CO3 BTL3
a. Synthesized attributes
b. Inherited attributes
24. c. Dependency graph
d. Evaluation order
e. Directed Acyclic Graph (DAG)
UNIT IV
PART A
Blooms Level
Q. No. Questions CO (BTL1/BTL2)
1. Write the quadruple for the expression (x+y)∗(y+z)+(x+y+z)(x + y) \ast (y + CO4 BTL1
z) + (x + y + z)(x+y)∗(y+z)+(x+y+z).
2. Describe the concept of a DAG and its applications. CO4 BTL2
3. What are Abstract Syntax Trees? CO4 BTL1
4. Illustrate the use of address descriptors and register descriptors with examples. CO4 BTL2
5. What is common subexpression elimination? CO4 BTL1
6. Explain the concept of flow graphs and constant folding in program CO4
optimization. BTL2
23. Explain in detail about Activation tree with an example. CO4 BLT5
24. Explain Activation record with example of factorial program CO4 BLT5
UNIT V
PART A
Blooms Level
Q. No. Questions CO (BTL1/BTL2)
1. Define induction variables. CO5 BTL1
2. Illustrate how code motion improves the efficiency of a program. CO5 BTL2
3. Identify the concept of induction variables. CO5 BTL1
4. Describe how induction variable elimination enhances code optimization. CO5 BTL2
5. Explain machine-independent code optimization. CO5 BTL1
6. Explain how copy propagation helps in simplifying code. CO5 BTL2
7. Identify induction variables. CO5 BTL1
8. Explain the function and purpose of a flow graph in compiler design. CO5 BTL2
9. Define Basic Block CO5 BTL1
10. What are the characteristics of peep hole optimization? CO5 BTL1
PART B
Blooms Level
Q. No. Questions CO (BTL3 to BTL6)
11. Implement a partitioning algorithm to divide the given program into basic CO5 BTL3
blocks.
12. Construct the flow graph for the following program: CO5 BTL3
Prod = 0;
I = 1;
Do {
Prod = Prod + a[I] * b[I];
I = I + 1;
} while (I <= 10);
13. Perform code optimization by applying dead code elimination, variable CO5 BTL3
elimination, code motion, and reduction in strength on a sample program.
14. Categorize and explain the different types of loops, such as natural loops, CO5 BTL4
inner loops, and reducible flow graphs, with examples.
15. Examine the process of eliminating common sub-expressions with an example CO5 BTL4
and analyze its impact on code efficiency.
16. Assess the effectiveness of machine-dependent and machine-independent code CO5 BTL5
optimization techniques with suitable examples.
17. Evaluate the impact of applying code optimization techniques, such as dead CO5 BTL5
code elimination and reduction in strength, on a complex program.
18. Explain the DAG representation of basic block with example CO5 BTL5
19. Formulate an algorithm to identify and optimize inner loops and natural loops CO5 BTL6
in a program.
20. Develop a comprehensive example demonstrating the use of control and data CO5 BTL6
flow analysis for optimizing a code segment
PART C
Blooms Level
Q. No. Questions CO (BTL3 to BTL6)
For the code CO5 BTL5
Sum = 0
do 10 i=1, n
10 sum = sum +a(i) *a(i)
Explain the following:
21. 1)Three address code
2) Control flow graph
3) Local common sub expression elimination
4) Invariant code motion
5) Reduction in strength
22. Compare various data flow algorithms with an example. CO5 BTL4
Examine and illustrate the concept of peephole optimization techniques by CO5 BTL4
23. analyzing their impact on reducing redundant instructions, improving code
efficiency, and optimizing resource usage.
24. Explain in detail about basic blocks and flow graphs with an example. CO5 BTL5