GATE CS 2023 | Question 37
Compiler Design › Runtime Environment · MCQ · 2 marks · Answer: D
- Question 37Compiler Designmcq2 marksFor the control flow graph shown (blocks B1-B4, with B1: i=m-1, j=n, a=10; B2: i=i+1, j=j-1; B3: a=20; B4: i=a+1), which choice lists the live variables at the EXIT of each basic block?

- A.B1: {}, B2: {a}, B3: {a}, B4: {a}
- B.B1: {i,j}, B2: {a}, B3: {a}, B4: {i}
- C.B1: {a,i,j}, B2: {a,i,j}, B3: {a,i}, B4: {a}
- D.B1: {a,i,j}, B2: {a,j}, B3: {a,j}, B4: {a,i,j}✓
Answer: D
Solution
Answer: (D) B1: {a,i,j}, B2: {a,j}, B3: {a,j}, B4: {a,i,j} Compute live variables backward (a variable is live at a point if it is used later before being redefined). Tracing the uses — B4 uses (and loops back using ), B2 uses , B3 defines used in B4 — gives the live-out sets B1:{a,i,j}, B2:{a,j}, B3:{a,j}, B4:{a,i,j}, matching option (D). - A.
More GATE PYQ on Runtime Environment
All GATE CS Compiler Design PYQ →Attempt GATE CS 2023 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →