NPTEL Compiler Design Week 4 Assignment Answers 2024

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL Compiler Design Week 4 Assignment Answers 2024

1. Consider the following grammar G:
S → S+S|S-S|S x S|S/S| (S) |-S |0|1|- -19
Which of the following expression is not a member of L(G)?

(A) (((1+2)*(2+3)+1)*2)|
(B) ((1+2)(2+3))
(C) (((((1+2)))))
(D) (1-2-3-4-5)

Answer :- For Answer Click Here 

2. Cosider the following grammar G:
S → 0SO| 1S1 &
What is L(G)? Choose the right option from below.

(A) L(G) = (w € (0, 1}*| number of 1’s is equal to number of O’s in w}
(B) L(G) = (w € {0, 1}* |w= wR and |w| is even}
(C) L(G) = (w € (0, 1}° | w = wR and |w| is odd}
(D) None of the above

Answer :- For Answer Click Here 

3.

NPTEL Compiler Design Week 4 Assignment Answers 2024
Answer :- For Answer Click Here 

4.

NPTEL Compiler Design Week 4 Assignment Answers 2024
Answer :- 

5.

NPTEL Compiler Design Week 4 Assignment Answers 2024
Answer :- 

6. Which derivation method does a top-down parser use?

(A) Leftmost derivation
(B) Leftmost derivation in reverse
(C) Rightmost derivation
(D) Rightmost derivation in reverse

Answer :- For Answer Click Here 

7. Consider the following grammar:
S → aSa | bSb | A
A → aBb | bBa| aB
B → aB | bB|€
Choose the proper set from below which is equal to Follow (B).

(A) ($)
(B) (b}
(C) (a, b)
(D) {$, a, b)

Answer :- 

8. What is Follow(A) for the following grammar?
A → BCx /y
B→ yA|s
C→ Ay |x

(A) ($)
(B) (x, $}
(C) (y, $}
(D) (x, y, $}

Answer :- 

9. Which of the following is true about left factoring?

(A) It is the process of factoring out of common Prefixes of production rules
(B) It is the process of factoring out of common Suffixes of production rules
(C) Both(a) and (b) are applicable
(D) None of the other options

Answer :- 

10.

NPTEL Compiler Design Week 4 Assignment Answers 2024
Answer :- For Answer Click Here