GATE CS 2026 Set 2 | Question 45

Compiler Design › Intermediate Code & Code Optimization · MCQ · 2 marks · Answer: A

  1. Question 45Compiler Designmcq2 marks
    Consider the control flow graph given below. Which one of the following options is the set of live variables at the exit point of each basic block?
    GATE CS 2026 Set 2 Question 45 figure
    • A.
      B1:{a, b, c, e, f}, B2:{d, e}, B3:{b, c, e, f}, B4:
      ✓
    • B.
      B1:, B2:{d, e}, B3:{a, c, f}, B4:
    • C.
      B1:{a, b, c, e, f}, B2:{d, e}, B3:{c, e, f}, B4:
    • D.
      B1:, B2:{d, e, f}, B3:{a, b, c, e, f}, B4:

    Answer: A

    Solution

    Answer: (A) Working backwards (a variable is live at a point if it is used later before being redefined): - At B4 exit (program end): . - B3 () loops back to B1, which uses ; is used in B2/B4 and again in B3 — live out of B3 . - B2 () flows to B4 which uses — live out . - B1 () reaches B2 and B3 which together use — live out . This matches option (A).

More GATE PYQ on Intermediate Code & Code Optimization

All GATE CS Compiler Design PYQ →

Attempt GATE CS 2026 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →