A) Replacing variables with constant values when possible
B) Removing loops that do not affect output
C) Evaluating expressions at runtime
D) Reordering instructions for better performance
View AnswerA
52. What is “loop fusion” in compiler optimization?
A) Merging two loops that have the same iteration space
B) Unrolling loops for optimization
C) Eliminating unreachable code in a loop
D) Converting recursive functions to loops
View AnswerA
53. What does “data flow analysis” focus on in compilers?
A) Analyzing the flow of data through the variables and expressions in the program
B) Tracking the flow of control statements
C) Linking different program modules
D) Managing memory allocation for variables
View AnswerA
54. What is “live variable analysis” in compilers?
A) Determining which variables hold values that will be used in the future
B) Analyzing dead code
C) Checking if variables are initialized
D) Detecting memory leaks in the program
View AnswerA
55. What is “operator strength reduction” in compiler optimization?
A) Replacing expensive operations with equivalent cheaper ones
B) Eliminating dead code
C) Removing unnecessary loops
D) Replacing functions with inline code
View AnswerA
56. Which of the following is NOT an optimization technique?
A) Dead code elimination
B) Constant folding
C) Syntax analysis
D) Loop unrolling
View AnswerC
57. What is a “phase” in the context of a compiler?
A) A specific stage of the compilation process, such as lexical analysis or code generation
B) A data structure for storing tokens
C) A method for semantic analysis
D) A section of machine code
View AnswerA
58. What is “tail recursion” in compilers?
A) A form of recursion where the recursive call is the last operation in the function
B) A method for generating tokens
C) An optimization that eliminates unreachable code
D) A type of error in lexical analysis
View AnswerA
59. What does the “front-end” of a compiler focus on?
A) Analyzing and processing the source code
B) Optimizing the generated machine code
C) Linking external libraries
D) Executing the compiled code
View AnswerA
60. What is “loop invariant code motion” in compiler optimization?
A) Moving code that does not change during a loop outside the loop
B) Removing unreachable code in loops
C) Unrolling loops for better performance
D) Replacing a loop with recursive function calls
View AnswerA
61. What is “register spilling” in compiler optimization?
A) Storing variables in memory when there are not enough registers
B) Allocating registers for variables
C) Removing redundant code from loops
D) Evaluating expressions at compile time
View AnswerA
62. What is “hoisting” in compiler optimization?
A) Moving statements outside of loops if they are loop invariant
B) Unrolling loops for better performance
C) Inlining functions to reduce call overhead
D) Generating machine code
View AnswerA
63. What is the purpose of “loop interchange” in compiler optimization?
A) To improve cache performance by changing the nesting order of loops
B) To remove loops that are not used
C) To replace recursive function calls with loops
D) To eliminate dead code
View AnswerA
64. What is “spill code” in compiler design?
A) Instructions that save or load values to/from memory when registers are full
B) Redundant code that is eliminated by the compiler
C) Machine-independent code that is generated by the front-end
D) Optimized machine code for a specific architecture
View AnswerA
65. What is the purpose of “function inlining” in compiler optimization?
A) To replace a function call with the actual code of the function
B) To generate tokens from source code
C) To reduce the depth of recursive calls
D) To check the semantic correctness of the code
View AnswerA
66. What is “syntax-directed translation” in compiler construction?
A) Generating intermediate code based on the syntax rules of the language
B) Checking for syntax errors
C) Linking external libraries
D) Performing semantic analysis
View AnswerA
67. What is the role of a “peephole optimizer” in a compiler?
A) To perform local optimization on small sections of code
B) To detect and report errors in the source code
C) To generate tokens from source code
D) To convert intermediate code into machine code
View AnswerA
68. What is “data dependency analysis” in compiler optimization?
A) Analyzing the dependencies between variables and expressions
B) Analyzing the control flow of a program
C) Allocating memory for variables
D) Linking object files
View AnswerA
69. Which of the following is a bottom-up parsing technique?
A) LR parsing
B) LL parsing
C) Recursive descent parsing
D) Predictive parsing
View AnswerA
70. What is “lexical scoping”?
A) The scope of variables is determined by their position in the source code
B) The dynamic scope of variables is determined during runtime
C) Managing memory during code generation
D) Checking for semantic errors
View AnswerA
71. What does the “back-end” of a compiler focus on?
A) Code generation and optimization
B) Syntax and semantic analysis
C) Token generation
D) Error detection
View AnswerA
72. What is the purpose of “control flow analysis”?
A) To determine the flow of control in the program through loops, branches, and function calls
B) To analyze memory allocation for variables
C) To check for syntax errors in the source code
D) To generate machine code
View AnswerA
73. What is “alias analysis” in compiler optimization?
A) Determining if different variables refer to the same memory location
B) Checking if variables are used before initialization
C) Determining the type of variables in the source code
D) Checking for syntax errors
View AnswerA
74. What is “folding” in compiler optimization?
A) The process of evaluating constant expressions at compile time
B) Eliminating unreachable code
C) Generating machine code
D) Optimizing loops for performance
View AnswerA
75. What is a “left-recursive grammar”?
A) A grammar where the left-most non-terminal in a production refers to itself
B) A grammar with ambiguous productions
C) A grammar that cannot be parsed by a recursive descent parser
D) A grammar that uses both top-down and bottom-up parsing techniques
View AnswerA
76. What is “left factoring” in a compiler?
A) A grammar transformation used to remove ambiguity
B) A method for optimizing code
C) A type of error in syntax analysis
D) A technique for lexical analysis
View AnswerA
77. What is “right recursion” in a context-free grammar?
A) When a non-terminal appears at the right end of the production
B) When a non-terminal appears at the left end of the production
C) An error in the syntax of the program
D) A method for semantic analysis
View AnswerA
78. What is the purpose of “static single assignment” (SSA) form in compiler optimization?
A) To ensure that each variable is assigned exactly once
B) To analyze the control flow of a program
C) To perform semantic analysis
D) To check for syntax errors
View AnswerA
79. What is “type inference” in compiler design?
A) Determining the data types of variables based on their usage
B) Checking if variables are used before initialization
C) Analyzing the flow of control statements
D) Generating intermediate code
View AnswerA
80. What is “abstract interpretation” in compiler construction?
A) A method for statically analyzing programs to predict their runtime behavior
B) A technique for performing lexical analysis
C) A method for generating tokens from source code
D) A phase of code generation
View AnswerA
81. What is “parser generator”?