Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q491: The term 'recursive descent' refers to parsing from ________ downwards.
- A: root
- B: to leaves
- C: leaves
- D: to root
View Answer
A
Q492: In the grammar fragment expr → term expr', the symbol expr' represents ________.
- A: a continuation of expr
- B: an alternative term
- C: a terminal
- D: a non-terminal
View Answer
D
Q493: The method isPresent() is typically ________ in C++ classes for parsing.
- A: abstract
- B: implemented
- C: virtual
- D: static
View Answer
C
Q494: In LL(1) parsing, error detection occurs when the current token is not in any ________ set of the expected productions.
- A: FIRST
- B: FOLLOW
- C: EOF
- D: START
View Answer
A
Q495: Which of the following operators appear in the term production in the example grammar?
- A: * and /
- B: + and -
- C: = and !=
- D: < and >
View Answer
A
Q496: Which symbol in the grammar helps the parser decide the correct production when ε-productions are present?
- A: FIRST+
- B: FIRST
- C: FOLLOW
- D: EOF
View Answer
A
Q497: The C++ class Factor inherits from ________.
- A: NonTerminal
- B: Expr
- C: Term
- D: Tprime
View Answer
A
Q498: In recursive descent parsing, mutual recursion between functions represents ________.
- A: grammar productions
- B: token scanning
- C: error handling
- D: lexer functions
View Answer
A
Q499: The class Eprime constructor requires a pointer to a ________.
- A: TreeNode
- B: Scanner
- C: Token
- D: Parser
View Answer
A
Q500: Which class is responsible for parsing expressions within parentheses?
- A: Term
- B: Expr
- C: Factor
- D: Tprime
View Answer
C