Skip to content
GATEiit

GATE CSE 2026 Session 2 Q45: Live variables at the exit of each block in a loop CFG

Question

Consider the control flow graph given below.

Control flow graph: ENTRY to B1 (a = b + c); B1 goes to B2 (d = a + e) and to B3 (e = a + f); B3 loops back to B1; B2 goes to B4 (g = d + e), which goes to EXIT
Tap the figure to enlarge

Which one of the following options is the set of live variables at the exit point of each basic block?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: A (official GATE 2026 final answer key)

Concept used: Backward data flow: IN[B]=use[B]∪(OUT[B]−def[B])\text{IN}[B] = \text{use}[B] \cup (\text{OUT}[B] - \text{def}[B]), OUT[B]=⋃IN[succ]\text{OUT}[B] = \bigcup \text{IN}[\text{succ}].

First step: Start from OUT[B4] = ∅ and iterate the equations around the B1 → B3 → B1 loop until nothing changes.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2026 Session 2 CS question paper and final answer key, organised by IIT Guwahati. Question paper · Answer key