Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q711: The number of complete handles in a grammar is equal to the number of __________.
- A: productions
- B: states
- C: stack entries
- D: reductions
View Answer
A
Q712: The total number of potential handles is equal to the ________ of the right-hand side lengths of all productions.
- A: product
- B: average
- C: sum
- D: maximum
View Answer
C
Q713: Which LR parser variant uses one-symbol lookahead?
- A: LR(0)
- B: SLR
- C: LALR
- D: LR(1)
View Answer
D
Q714: What is stored in the stack along with symbols in LR parsing to track DFA state?
- A: Lookahead symbol
- B: State number
- C: Production ID
- D: Action type
View Answer
B
Q715: Which table in LR parsing corresponds to terminals and DFA states?
- A: Action table
- B: Goto table
- C: Parse table
- D: Derivation table
View Answer
A
Q716: Which table is used to find transitions on non-terminals in LR parsers?
- A: Action table
- B: Goto table
- C: Shift table
- D: Stack table
View Answer
B
Q717: In the DFA model of LR parsing, rows represent DFA states. What do the columns represent?
- A: Parsing errors
- B: Non-terminals only
- C: Terminals and non-terminals
- D: Symbolic tokens
View Answer
C
Q718: What does LR(1) stand for in LR(1) parsers?
- A: Left-to-right scan with 1 error
- B: Lookahead Reduction with 1 shift
- C: Left-to-right scan with 1-symbol lookahead
- D: Lexical Reduction type 1
View Answer
C
Q719: LR(1) parsing technique uses ______ to resolve shift/reduce conflicts.
- A: Top-down approach
- B: Operator precedence
- C: One-symbol lookahead
- D: Recursion
View Answer
C
Q720: An LR(1) item includes a production rule and its ________.
- A: Length
- B: Follow set
- C: Lookahead symbol
- D: Non-terminal
View Answer
C