Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q801: Which is NOT part of an LR(1) item?
- A: Parsing stack
- B: Production
- C: Dot symbol
- D: Look-ahead symbol
View Answer
A
Q802: What does goto(Ij, X) return?
- A: Set of items after recognizing X from Ij
- B: Reduced grammar
- C: Set of terminals
- D: New grammar
View Answer
A
Q803: The LR(1) transition diagram is a _______.
- A: DFA
- B: NFA
- C: PDA
- D: Turing machine
View Answer
A
Q804: In LR parsing, the stack stores _______.
- A: States and symbols
- B: Only terminals
- C: Only non-terminals
- D: Look-ahead symbols
View Answer
A
Q805: Transition from I4 to I5 on 'int' leads to item _______.
- A: [E → int•, )/+]
- B: [E → •int, $/+]
- C: [E → E + (• E), $/+]
- D: [S → E•, $]
View Answer
A
Q806: What is the initial state in the LR parser construction?
- A: The state containing [S' → •S, $]
- B: The state containing [E → •T, $]
- C: The state containing [T → •F, $]
- D: The state containing [F → •id, $]
View Answer
A
Q807: Which of the following is NOT a parsing action in LR(1) table?
- A: Shift
- B: Reduce
- C: Accept
- D: Reject
View Answer
D
Q808: The symbol '$' in the parsing table denotes:
- A: End of file marker
- B: Start of input
- C: Any terminal symbol
- D: Non-terminal symbol
View Answer
A
Q809: The rule for setting Goto[i, A] in the LR table is based on:
- A: Terminal symbols
- B: Non-terminal symbols
- C: Grammar rules
- D: Parser states
View Answer
B
Q810: The set CC = {I0, I1, I2, ..., In} in LR parsing represents:
- A: Parser actions
- B: Parser states
- C: Grammar productions
- D: Input symbols
View Answer
B