GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Backpatching with no fall-through optimisation, numbering from 100, for: if (!(p < q)) x = 1; while (i < n) { if (a < b || c < d) k = k + 1; else k = k - 1; } How many instructions are generated?

  1. A. 12
  2. B. 14
  3. C. 15
  4. D. 13

Correct answer: D. 13

if with a negated test: 2 jumps + assignment = 3; while test 2 + if-else (4 + 1 + 1 + 1 = 7) + closing goto 1 = 10: total 13.

More Compiler Design questions

Exams that ask this topic