Compiler Design Week 6 Nptel Assignment Answers
Are you looking for NPTEL Compiler Design Week 6 Nptel Assignment Answers ? You’ve come to the right place! Access the most accurate answers at Progiez.
Table of Contents

Compiler Design Week 6 Nptel Assignment Answers (Jan-Apr 2025)
Course Link: Click Here
Q1. For the grammar
S’ → S
S → CC
C → cC | d
In state 0 of LR(1) parser, an item included is
a) C → .cC; c
b) C → .cC; d
c) C → .cC; c, d
d) C → .cC; c, S
Q2. For the grammar
S’ → S
S → CC
C → cC | d
In state 0 of LR(1) parser, an item included is
a) C → d; c
b) C → .d; d
c) C → .d; c, d
d) C → .d; c, $
Q3. In SLR parsing, to get a shift-reduce conflict for state I on terminal symbol ‘a’,
a) A → a.ß with First(ß) containing ‘a’ should be in I
b) A → S. be in I with Follow(A) having ‘a’
c) A → aß with First(ß) containing ‘a’ should be in I and A → 8. be in I with Follow(A) having ‘a’
d) None of the other options
Q4. In state I, we have the items A → a. and B → S., First(A), Follow(A), and Follow(B) contain the symbol ‘a’. This leads to
a) Shift-reduce conflict
b) Reduce-reduce conflict
c) Both shift-reduce and reduce-reduce conflicts
d) No conflicts
Q5. Which of the following statements is true regarding LR parsers?
a) SLR and Canonical LR have the same number of states.
b) LALR and Canonical LR have the same number of states.
c) SLR and LALR have the same number of states.
d) All three have the same number of states.
Q6. Construction of parsing table in which strategies do not need the Follow set?
a) SLR and Canonical LR
b) Canonical LR and LALR
c) SLR and LALR
d) None of the given options
Q7. In SLR parsing for the grammar
E’ → E
E → aEbE | bEaE | e
In state 0, for inputs ‘a’ and ‘b’
a) Both will have shift-reduce conflict
b) Only ‘a’ will have shift-reduce conflict
c) Only ‘b’ will have shift-reduce conflict
d) Neither of the other options
Q8. Amount of lookahead in LALR parser is
a) 1
b) 2
c) 3
d) None
Q9. In SLR parsing for the grammar
S → B | Sabs
B → bB | e
In state 0, for inputs ‘a’ and ‘b’
a) Both will have shift-reduce conflict
b) Only ‘a’ will have shift-reduce conflict
c) Only ‘b’ will have shift-reduce conflict
d) Neither of the other options
Q10. Which of the following parser types is the most powerful in terms of recognizing a broader class of grammars?
a) LL(1)
b) SLR(1)
c) LALR(1)
d) LR(1)
Q11. What is the similarity between LR, LALR, and SLR?
a) Use the same algorithm, but different parsing tables.
b) Same parsing table, but different algorithms.
c) Their parsing tables and algorithm are similar but use a top-down approach.
d) Both parsing tables and algorithm are different.
Compiler Design Week 6 Nptel Assignment Answers (Jan-Apr 2025)
For answers to others Nptel courses, please refer to this link: NPTEL Assignment