Phases of Compilation MCQs January 8, 2026December 13, 2024 by u930973931_answers 10 min Score: 0 Attempted: 0/10 Subscribe 1. Which of the following is the first phase of compilation? (A) Code Generation (B) Syntax Analysis (C) Lexical Analysis (D) Optimization 2. In which phase of the compilation process are syntax errors detected? (A) Lexical Analysis (B) Semantic Analysis (C) Code Generation (D) Syntax Analysis 3. What is the role of the semantic analysis phase in compilation? (A) To check for errors in the syntax of the source code (B) To ensure the meaning of the program is valid, such as type checking (C) To assign memory addresses to variables (D) To optimize the code 4. What does the intermediate code generation phase do? (A) Converts the source code into an intermediate form for further optimization (B) Converts the source code directly into machine code (C) Converts the program into a human-readable form (D) Executes the program immediately 5. Which of the following is the primary function of the code generation phase? (A) Translate the program into an intermediate code (B) Optimize the code (C) Convert the intermediate code into machine code (D) Check for semantic errors in the code 6. Which phase of the compiler handles error detection and reporting related to program semantics? (A) Lexical Analysis (B) Syntax Analysis (C) Optimization (D) Semantic Analysis 7. In which phase does the compiler generate the final machine-level code? (A) Lexical Analysis (B) Syntax Analysis (C) Optimization (D) Code Generation 8. The optimization phase of compilation is concerned with: (A) Checking for syntax errors (B) Assigning variable types (C) Converting source code into machine code (D) Making the code more efficient without changing its behavior 9. Which phase is responsible for breaking the input program into tokens? (A) Syntax Analysis (B) Code Generation (C) Lexical Analysis (D) Optimization 10. In which phase are the final machine instructions selected and arranged for execution? (A) Lexical Analysis (B) Code Generation (C) Syntax Analysis (D) Intermediate Code Generation