Computer Science EngineeringVery hardISRO SC

Three-address code: 1: x1 = x2 + 1; 2: x2 = x3 + 2; 3: x3 = x1 + 3; 4: x1 = x2 + 4; 5: x2 = x3 + 5; 6: goto 8; 7: x1 = x2 + 7; 8: if x1 < 8 goto 2; 9: if x1 < 9 goto 8; 10: x1 = x2 + 10; 11: x2 = x3 + 11; 12: x3 = x1 + 12; 13: x1 = x2 + 13. Using the standard leader rules (first instruction, every jump target, every instruction immediately after a jump), the number of basic blocks is

  1. A. 6
  2. B. 7
  3. C. 5
  4. D. 8

Correct answer: A. 6

Leaders are 1, 2, 7, 8, 9, 10; each leader starts one block, so 6 blocks.

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

Exams that ask this topic