Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q481: The function Goal() returns true only if Expr() returns true and token equals ________.
- A: EOF
- B: NULL
- C: ε
- D: $
View Answer
A
Q482: In recursive descent parsing, each non-terminal corresponds to a ________.
- A: function
- B: class
- C: method
- D: object
View Answer
A
Q483: The method isPresent() in the C++ parser class returns a ________.
- A: boolean
- B: value
- C: node
- D: tree
View Answer
A
Q484: The class Expr inherits from the base class ________.
- A: NonTerminal
- B: Scanner
- C: TreeNode
- D: Parser
View Answer
A
Q485: In object-oriented recursive descent parsing, parse tree nodes are typically stored as ________.
- A: pointers
- B: integers
- C: strings
- D: arrays
View Answer
A
Q486: The parser code snippet: if(token ∈ FIRST(b2)) find a b2 and return true; else error and return false; represents a ________.
- A: decision structure
- B: loop
- C: assignment
- D: function call
View Answer
A
Q487: Which of the following is NOT part of LL(1) parsing?
- A: Using look-ahead tokens
- B: Left-to-right scanning
- C: Left-most derivation
- D: Right-most derivation
View Answer
D
Q488: In the recursive descent parser, the token_type op can be PLUS or MINUS in the function ________.
- A: Eprime
- B: Expr
- C: Term
- D: Factor
View Answer
A
Q489: In C++ recursive descent parsing, the constructor of class NonTerminal accepts a ________.
- A: Scanner pointer
- B: Parse tree
- C: Token
- D: Grammar
View Answer
A
Q490: To maintain LL(1) property, productions for the same non-terminal must have disjoint ________.
- A: FIRST sets
- B: FOLLOW sets
- C: Terminals
- D: Non-terminals
View Answer
A