Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q641: abbcde reduces to S in which grammar?
- A: S → aABe; A → Abc | b; B → d
- B: S → abcde
- C: S → abcd
- D: S → aAbce
View Answer
A
Q642: If γ contains only terminals, γ is a ______.
- A: Sentence
- B: Non-terminal
- C: Production
- D: Grammar
View Answer
A
Q643: In shift-reduce parsing, which of the following is NOT an action?
- A: Shift
- B: Reduce
- C: Expand
- D: Accept
View Answer
C
Q644: Shift action is used to move a ______ to the left string.
- A: Non-terminal
- B: Terminal
- C: Error
- D: Derivation
View Answer
B
Q645: In bottom-up parsing, the input string is initially in what state?
- A: Fully reduced
- B: Partially parsed
- C: Fully unexamined
- D: Fully derived
View Answer
C
Q646: The dividing point between examined and unexamined input in parsing is marked by ______.
- A: $
- B: â–º
- C: #
- D: *
View Answer
B
Q647: In shift-reduce parsing, what does E → int represent?
- A: A terminal match
- B: Reduction rule
- C: A grammar conflict
- D: None of the above
View Answer
B
Q648: Which string represents the final reduced form in the example: int + (int) + (int)?
- A: E
- B: E + E
- C: E + (E)
- D: E + (E) + (E)
View Answer
A
Q649: How many kinds of actions are used in bottom-up parsing?
- A: 1
- B: 2
- C: 3
- D: 4
View Answer
B
Q650: Which is NOT a characteristic of bottom-up parsing?
- A: It reads tokens left to right
- B: It builds leftmost derivation
- C: It uses shift-reduce
- D: It constructs rightmost derivation in reverse
View Answer
B