Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q571: Top-down parsing begins parsing from:
- A: Rightmost terminal
- B: Leftmost terminal
- C: Start symbol
- D: Follow set of grammar
View Answer
C
Q572: In the production S ā *bAg, what symbol is expected after matching b in bbg?
- A: A
- B: g
- C: S
- D: F
View Answer
B
Q573: If b ā FIRST(a), then which of the following is TRUE?
- A: A ā a can be used when the next input is b
- B: A must be replaced by epsilon
- C: A cannot be expanded
- D: B should be replaced by a
View Answer
A
Q574: If ε ā FIRST(A) and b ā FOLLOW(A), then:
- A: A can be expanded using A ā ε
- B: A must be skipped
- C: A cannot be used
- D: A must derive terminal
View Answer
A
Q575: The FIRST set of a non-terminal includes:
- A: Only terminals directly used in its productions
- B: Only non-terminals that can derive it
- C: Terminals that appear first in any derivation from that symbol
- D: All tokens in the grammar
View Answer
C
Q576: FOLLOW(A) contains:
- A: All terminals that appear before A in derivations
- B: Terminals that can immediately follow A in derivations
- C: Non-terminals following A in productions
- D: All nullable symbols in the grammar
View Answer
B
Q577: The parse tree for a valid string is built by a _______ parser from the start symbol to the leaves.
- A: top-down
- B: bottom-up
- C: left-right
- D: right-left
View Answer
A
Q578: If a non-terminal has multiple productions starting with the same terminal, the grammar is:
- A: Left-factored
- B: LL(1)
- C: Ambiguous
- D: Non-recursive
View Answer
C
Q579: The parsing stack helps in:
- A: Identifying lexical tokens
- B: Simulating recursion by tracking derivations
- C: Evaluating expressions only
- D: Storing user-defined variables
View Answer
B
Q580: Predictive parsing is called table-driven because:
- A: It uses a stack to store functions
- B: It constructs the table dynamically
- C: It looks up a parsing table to decide the production to apply
- D: It stores entire grammar in table form
View Answer
C