Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q471: If a grammar has ε-productions, to satisfy LL(1) property we must ensure FIRST(b) is disjoint from ________.
  • A: FIRST(a)
  • B: FOLLOW(a)
  • C: FIRST+(a)
  • D: FOLLOW+(a)
View Answer
B

Q472: FOLLOW(a) is defined as the set of terminals that can legally appear ________ a in the grammar.
  • A: before
  • B: after
  • C: inside
  • D: none of these
View Answer
B

Q473: The set FIRST+(a) is defined as FIRST(a) ∪ FOLLOW(a) only if ________ is in FIRST(a).
  • A: ε
  • B: $
  • C: EOF
  • D: non-terminal
View Answer
A

Q474: A grammar is LL(1) if for all productions A → a and A → b, FIRST+(a) ∩ FIRST+(b) is ________.
  • A: empty
  • B: full
  • C: partial
  • D: undefined
View Answer
A

Q475: Predictive parsers are also known as ________ parsers because they predict the correct production.
  • A: top-down
  • B: bottom-up
  • C: shift-reduce
  • D: recursive
View Answer
A

Q476: Which parsing method is a kind of predictive parser?
  • A: Recursive descent
  • B: Bottom-up
  • C: Shift-reduce
  • D: LR parser
View Answer
A

Q477: In the code snippet for LL(1) parsing, if token ∈ FIRST(b1), the parser ________.
  • A: chooses b1
  • B: produces error
  • C: ignores token
  • D: looks ahead
View Answer
B

Q478: A recursive descent parser builds the parse tree in a ________ direction.
  • A: top-down
  • B: bottom-up
  • C: left-to-right
  • D: right-to-left
View Answer
A

Q479: In the provided grammar, expr' can be replaced by ε or expressions involving ________.
  • A: + or -
  • B: * or /
  • C: id or number
  • D: ( or )
View Answer
A

Q480: The grammar symbol 'e' used in the content represents ________.
  • A: epsilon (empty string)
  • B: expression
  • C: terminal
  • D: non-terminal
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now