Compiler Design MCQ Based On Learning Outcome
Compiler Design MCQ Based On Learning Outcome
14. Which of the following parsing techniques can handle left-recursive grammars?
a. Recursive descent parsing
b. LL(1) parsing
c. LR(0) parsing
d. SLR(1) parsing
19. Which of the following is not a technique for resolving shift-reduce conflicts in LR parsing?
a. Precedence declarations
b. Associativity declarations
c. Operator precedence rules
d. Lookahead symbols
20. Which of the following is not a strategy for error recovery in parsing?
a. Panic mode
b. Error propagation
c. Error correction
d. Backtracking
14. Which of the following parsing techniques can handle left-recursive grammars?
Answer: a. Recursive descent parsing
Explanation: Recursive descent parsing can handle left-recursive grammars by using appropriate
techniques such as left-factoring or recursion elimination.
20. Which of the following is not a strategy for error recovery in parsing?
Answer: c. Error correction
Explanation: Error correction typically refers to techniques used in code editors or integrated
development environments (IDEs) to suggest fixes for detected syntax errors. In parsing, error recovery
strategies include panic mode, error propagation, and backtracking.
24. The process of converting a high-level programming language into machine code is called:
a. Compilation
b. Interpretation
c. Execution
d. Debugging
30. Which phase of the compiler detects syntax errors in the input program?
a. Lexical analysis
b. Semantic analysis
c. Syntax analysis
d. Code generation
34. The process of rearranging the order of instructions to improve cache performance is known as:
a. Loop unrolling
b. Loop fusion
c. Loop interchange
d. Loop parallelization
37. Which of the following is not a factor that affects compiler performance?
a. Size of the input program
b. Speed of the processor
c. Complexity of the programming language
d. Memory availability
38. The process of transforming the abstract syntax tree into a lower-level representation is called:
a. Lexical analysis
b. Semantic analysis
c. Code generation
d. Code optimization
39. Which of the following is not a common method for error handling in compilers?
a. Printing an error message and terminating compilation
b. Recovering from errors and continuing compilation
c. Ignoring errors and producing an output anyway
d. Providing suggestions for fixing errors
4. The process of converting a high-level programming language into machine code is called:
Answer: a. Compilation
Explanation: Compilation is the process of translating a program written in a high-level language into
machine code, which can then be executed by the computer.
14. The process of rearranging the order of instructions to improve cache performance is known as:
Answer: c. Loop interchange
Explanation: Loop interchange is an optimization technique where the order of nested loops is changed to
improve cache performance by optimizing memory access patterns.
17. Which of the following is not a factor that affects compiler performance?
Answer: c. Complexity of the programming language
Explanation: The complexity of the programming language can indeed affect compiler performance.
Factors that can affect compiler performance include the size of the input program, speed of the
processor, and memory availability.
18. The process of transforming the abstract syntax tree into a lower-level representation is called:
Answer: c. Code generation
Explanation: Code generation is the process of transforming the intermediate representation (e.g.,
abstract syntax tree) into a lower-level representation, such as assembly language or machine code.
19. Which of the following is not a common method for error handling in compilers?
Answer: c. Ignoring errors and producing an output anyway
Explanation: Ignoring errors and producing an output anyway is not a common method for error handling
in compilers. Typically, compilers either terminate compilation upon encountering an error or try to
recover from errors and continue compilation.