Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q41: Which part of the compiler generates target machine code from IR?
- A: Front end
- B: Back end
- C: Scanner
- D: Parser
View Answer
B
Q42: What is the complexity class of most front-end compiler algorithms?
- A: NP-complete
- B: Exponential
- C: Polynomial
- D: Constant
View Answer
C
Q43: Most back-end algorithms in a compiler are _______.
- A: Polynomial
- B: NP-complete
- C: Linear
- D: Time-independent
View Answer
B
Q44: The front end of a compiler produces ______ for legal programs.
- A: Object code
- B: Assembly code
- C: Intermediate Representation (IR)
- D: Binary code
View Answer
C
Q45: Which module of the compiler converts character streams to tokens?
- A: Parser
- B: Scanner
- C: Generator
- D: Analyzer
View Answer
B
Q46: Which module processes tokens to construct syntax trees and checks grammar?
- A: Scanner
- B: Parser
- C: Assembler
- D: Interpreter
View Answer
B
Q47: The scanner outputs a stream of ______.
- A: Lexemes
- B: Tokens
- C: Statements
- D: Instructions
View Answer
B
Q48: The parser is responsible for recognizing ______ syntax.
- A: Semantic
- B: Grammar
- C: Programming
- D: Context-free
View Answer
D
Q49: A token is composed of ______.
- A: Only keyword
- B: Only identifier
- C: A token type and a word
- D: An operator and a variable
View Answer
C
Q50: Which type of grammar is used to specify programming language syntax?
- A: Context-free grammar
- B: Regular grammar
- C: Unrestricted grammar
- D: Linear grammar
View Answer
A