StreakPeaked· Practice

ExamsGATETechnical

Consider the following statements about the use of backpatching in a compiler for intermediate code generation: (I) Backpatching can be used to generate code for Boolean expression in one pass. (II) Backpatching can be used to generate code for flow-of-control statements in one pass. Which ONE of the following options is CORRECT?

  1. Only (I) is correct.
  2. Only (II) is correct.
  3. Both (I) and (II) are correct.
  4. Neither (I) nor (II) is correct.

Correct answer: Both (I) and (II) are correct.

Solution

Backpatching allows a compiler to handle jumps and branches in control flow and Boolean expressions efficiently by postponing the actual address resolution until all necessary information is available, enabling code generation in a single pass for both types of statements.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →