GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Backpatching scheme (each relation gives 'if r goto _' and 'goto _', no fall-through optimisation, instruction numbers from 100). How many instructions are generated for: while (a < b || c < d) while (e < f && g < h) x = x + 1; ?

  1. A. 10
  2. B. 12
  3. C. 8
  4. D. 11

Correct answer: D. 11

Outer test: 4 jumps; inner test: 4 jumps; assignment 1; inner loop's closing goto 1; outer loop's closing goto 1: 11.

More Compiler Design questions

Exams that ask this topic