Compilers Multiple Choice Questions & Answers (MCQs) on “Error Recovery in LR phase”.
1. The grammar S → aSa | bS | c is?
a) LL(1) but not LR(1)
b) LR(1) but not LR(1)
c) Both LL(1) but not LR(1) & LR(1) but not LR(1)
d) None of the mentioned
Answer: c
Clarification:
First(aSa) = a
First(bS) = b
First(c) = c
LR parsers are more powerful than LL (1) parsers and LR (1).
2. Recursive descent parsing is an example of ____________
a) Top down parsing
b) Bottom up parsing
c) Predictive parsing
d) None of the mentioned
Answer: a
Clarification: Top down is the answer.
3. LR stands for ___________
a) Left to right
b) Left to right reduction
c) Right to left
d) Right most derivation and Left to right and a in reverse
Answer: d
Clarification: Right most derivation and left to right and in reverse is used for LR.
4. Which is the most powerful parser?
a) SLR
b) LALR
c) Canonical LR
d) Operator-precedence
Answer: c
Clarification: Canonical tops all other parsers.