Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q701: Stack-relative notation like Expr β Expr β β’ Term indicates parser is waiting to parse a _______.
- A: Goal
- B: Term
- C: Minus
- D: Expression
View Answer
B
Q702: The final reduction in the parse tree corresponds to which production?
- A: Expr β Term
- B: Goal β Expr
- C: Factor β id
- D: Term β Factor
View Answer
B
Q703: The handle β¨Term β Term Γ Factor β’β© indicates what?
- A: Reduction is pending
- B: Handle is complete
- C: Parse error
- D: Stack is empty
View Answer
B
Q704: A complete handle always ends with which symbol in stack-relative notation?
- A: $
- B: β’
- C: β
- D: β’
View Answer
B
Q705: Which step in the example indicates accepting the input string?
- A: Step 13
- B: Step 15
- C: Step 11
- D: Step 9
View Answer
B
Q706: The parser uses a stack primarily to manage _______.
- A: Error reporting
- B: Grammar analysis
- C: Input tokens
- D: Parse frontier
View Answer
D
Q707: What is a handle in the context of bottom-up parsing?
- A: A non-terminal on the LHS
- B: A string to be shifted
- C: A substring matching the RHS of a production
- D: A DFA state
View Answer
C
Q708: Which of the following steps is typically taken by a bottom-up parser when it identifies a handle?
- A: Shift
- B: Reduce
- C: Accept
- D: Reject
View Answer
B
Q709: In a bottom-up parser, what does the placeholder "β’" indicate?
- A: An error in parsing
- B: The end of a stack
- C: The top of the parse stack
- D: The lookahead symbol
View Answer
C
Q710: How many placeholder positions are there in a production with k symbols on the RHS?
- A: k
- B: k+1
- C: kβ1
- D: k*2
View Answer
B