Computer Science EngineeringHardISRO SC

A flow graph has blocks B1: use{a,d} def{b}; B2: use{a} def{b,d}; B3: use{d} def{a,b,c}; B4: use{a} def{}. Edges: B1->B2, B2->B3, B2->B4, B3->B2. Variables are live at exit only if a later use exists; B4 is the exit. How many variables are live at the entry (IN) of B1? (use = read before any write in the block)

  1. A. 3
  2. B. 1
  3. C. 4
  4. D. 2

Correct answer: D. 2

Solve IN[B]=use[B] union (OUT[B]-def[B]) and OUT[B]=union of IN[succ] backward to a fixed point; IN[B1] = {a,d}.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic