NPTEL Compiler Design Week 11 Assignment Answers 2025

NPTEL Compiler Design Week 11 Assignment Answers 2025

1. For the rule S → L:= E, if L is a single variable, L.place is equal to

(A) Null
(B) Some value
(C) Constant
(D) None of the other options

Answer :- For Answers Click Here 

2. For Boolean variable B, B. truelist contains

(A) List of locations at which B is true
(D) None of the other options
(B) List of locations to jump to if B is true
(C) List of locations at which B is true and the locations to branch to

Answer :- 

3. When generating code for the Boolean expression “(x ≥ y) AND (p # q)”, which locations
are left for back patching?

a) Falselist of x≥y
b) Falselist of xzy and falselist of p * q
c) Falselist of xzy, falselist of p * q, truelist of p # q
d) Truelist of xey, falselist of xey, truelist of p # q, falselist of p # q

Answer :- 

4. In three-address code, arrays are

(A) Not supported
(B) One dimensional
(C) More than one dimensional
(D) Supported via pointers

Answer :- 

5. For three address code generation of “B > B1 or M B2*, M.quad is used to backpatch

(A) B1 truelist
(D) B2. falselist
(B) B1.falselist
(C) B2 truelist

Answer :- For Answers Click Here 

6. For the rule B → B1 and B2, the operation “B1.false = B.false” requires two passes as

(A) B1. false is not known
(B) .false is not known
(C) Both B1.false and B.false are unknown
(D) None of the other options

Answer :- 

7. In the rule C-C1 AND NG the non terminal N is used to remember the start address of:

(A) C
(B) C1
(C) Both C, and C
D) None of the other options

Answer :- 

8. In the rule S → if B then MS N else MS, N is used to generate a jump after

(A) then-part
(B) else-part
(D) None of the other options
(C) both then- and else-part

Answer :- 

9. In the rule S if B then M S1, M holds the start address for

(A) S1
(B) S
(с) в
(D) None of the other options

Answer :- 

10. For three address code generation of rule “S → while M1 B do M2 S1”, B.falselist is backpatched with

(A) M1. quad
(D) None of the other options
(B) M2 quad
(C) Cannot be backpatched at this point

Answer :- 

11. In three-address code (TAC), accessing an array element typically requires:

(A) Direct assignment without indexing
(B) Computing an address using the base address and an offset
(C) Using only registers without memory references
(D) None of the other options

Answer :- 

12. In the rule S → while M1 B do M2 S1, the non-terminal M2 is used to remember the start
address of:

(A) S
(B) B
(C) S1
(D) None of the other options

Answer :- 

13. For a Boolean expression B, the attribute B.falselist contains:

(A) List of locations where B evaluates to false
(B) List of locations to jump to if B is false
(C) List of locations where B is false and the locations to branch to
(D) None of the other options

Answer :- For Answers Click Here 
Scroll to Top