Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q541: The production rule for F includes which of the following?
- A: F → id
- B: F → + E'
- C: F → id * F
- D: F → e
View Answer
A
Q542: In the AST, which operator is applied first in the expression 2 + 4 * 6?
- A: +
- B: *
- C: /
- D: =
View Answer
B
Q543: Predictive parsing avoids recursion by using ________.
- A: stack trace
- B: input buffer
- C: parsing history
- D: token tree
View Answer
A
Q544: Which function initiates the parsing process for an expression?
- A: Term::isPresent()
- B: Expr::isPresent()
- C: Factor::isPresent()
- D: Eprime::isPresent()
View Answer
B
Q545: The input string id+id*id$ ends with which character to signal parsing end?
- A: *
- B: id
- C: +
- D: $
View Answer
D
Q546: Tprime::isPresent() returns true only when it encounters which operator?
- A: +
- B: *
- C: /
- D: * or /
View Answer
D
Q547: Eprime handles operations related to which mathematical functions?
- A: Addition and Subtraction
- B: Multiplication and Division
- C: Parentheses
- D: Exponentiation
View Answer
A
Q548: The call to s->advance() in parsing code is used to
- A: Skip whitespaces
- B: Move to next token
- C: Print token
- D: Build tree
View Answer
B
Q549: The predictive parsing table has rows as ________ and columns as ________.
- A: terminals, non-terminals
- B: operators, operands
- C: non-terminals, terminals
- D: keywords, operators
View Answer
C
Q550: The rule F → ( E ) is applied when the parser encounters
- A: )
- B: (
- C: +
- D: id
View Answer
B