Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q71: What type of tree is used to represent the full derivation in a compiler?
- A: Parse tree
- B: Abstract syntax tree
- C: Decision tree
- D: Binary tree
View Answer
A
Q72: What does a parse tree capture during compilation?
- A: Errors
- B: All rewrite steps during derivation
- C: Token mapping
- D: Optimization steps
View Answer
B
Q73: To extract derivation from a parse tree, we start from ______.
- A: Leaf nodes
- B: Tokens
- C: Root node
- D: Grammar rules
View Answer
C
Q74: The AST for expression x + 2 - y omits ______ from the parse tree.
- A: Operators
- B: Derivation details
- C: Identifiers
- D: Constants
View Answer
B
Q75: An AST is an example of ______ in a compiler.
- A: Source code
- B: Token
- C: Intermediate Representation
- D: Assembler instruction
View Answer
C
Q76: Which tree represents the grammatical structure without derivation steps?
- A: Syntax tree
- B: Parse tree
- C: Abstract Syntax Tree
- D: Binary tree
View Answer
C
Q77: Which of the following is a more concise representation?
- A: Parse tree
- B: AST
- C: Error tree
- D: Stack tree
View Answer
B
Q78: The AST for expression x + 2 – y contains how many operator nodes?
- A: 1
- B: 2
- C: 3
- D: 0
View Answer
B
Q79: Which of the following best describes AST?
- A: Graphical representation of source code
- B: Summary of syntax and semantics
- C: Summary of grammatical structure
- D: Mapping of tokens to expressions
View Answer
C
Q80: The back end of the compiler translates IR into ______.
- A: Bytecode
- B: Assembly code
- C: Machine code
- D: Pseudocode
View Answer
C