Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q671: The handle in bottom-up parsing corresponds to a step in _______.
- A: Leftmost derivation
- B: Rightmost derivation
- C: Center derivation
- D: Topmost derivation
View Answer
B
Q672: In bottom-up parsing, the symbol ‘$’ indicates _______.
- A: End of input
- B: Start of stack
- C: Start symbol
- D: Error marker
View Answer
A
Q673: In handle pruning, what is pruned from the parse tree?
- A: The root
- B: The leaves
- C: The matched handle
- D: The unmatched terminal
View Answer
C
Q674: Which of the following actions is not part of bottom-up parsing?
- A: Shift
- B: Reduce
- C: Error detection
- D: Derive new grammar rules
View Answer
D
Q675: If a handle is found on top of the stack, what happens next?
- A: The handle is ignored
- B: The handle is pushed again
- C: The handle is reduced
- D: The handle is popped and ignored
View Answer
C
Q676: The parsing algorithm will continue until ______.
- A: Sym is $ and stack contains Goal on top of $
- B: All terminals are parsed
- C: All non-terminals are reduced
- D: Stack is full
View Answer
A
Q677: The pair 〈A→β,k〉 includes which information?
- A: A’s left-hand side and stack top
- B: A production rule and its position
- C: A token and its symbol
- D: A derivation and grammar
View Answer
B
Q678: What data structure is used in shift-reduce parsing to manage the input and parsing state?
- A: Queue
- B: Stack
- C: Tree
- D: List
View Answer
B
Q679: In shift-reduce parsing, what does the "reduce" operation do?
- A: Adds a terminal symbol
- B: Pops symbols and pushes a non-terminal
- C: Removes non-terminal symbols
- D: Shifts next token onto the stack
View Answer
B
Q680: The ► symbol in shift-reduce parsing represents the _______.
- A: Bottom of the stack
- B: Top of the stack
- C: End of parsing
- D: Error point
View Answer
B