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.


Compiler Design Week 6 Nptel Assignment Answers
Compiler Design Week 6 Nptel Assignment Answers

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

View Answer


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, $

View Answer


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

View Answer


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

View Answer


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.

See also  Compiler Design Week 2 Nptel Assignment Answers

View Answer


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

View Answer


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

View Answer


Q8. Amount of lookahead in LALR parser is

a) 1
b) 2
c) 3
d) None

View Answer


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

View Answer


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)

View Answer


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.

View Answer


Compiler Design Week 6 Nptel Assignment Answers (Jan-Apr 2025)

For answers to others Nptel courses, please refer to this link: NPTEL Assignment