GateAI
Intermediate Code Generation

GATE CSE 2025 Set 2 · Q21

MCQ1 markMedium

Time

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?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) Both (I) and (II) are correct.

Intermediate Code Generation

Backpatching is an intermediate code generation technique designed to resolve forward jumps in a single pass without needing a separate pass to resolve labels:

  • Statement (I): Backpatching can be used to generate code for Boolean expressions (such as short-circuit evaluation) in one pass by maintaining lists of unresolved jump instructions (truelist and falselist) and filling in target labels when they become known.

  • Statement (II): Backpatching can also be used to generate code for flow-of-control statements (like if-then, if-then-else, while, etc.) in one pass by maintaining a nextlist to patch branch targets when control reaches the subsequent code.

Therefore, both Statement (I) and Statement (II) are correct.

Hence, the correct option is (C).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Intermediate Code Generation previous year question is Q21 of the GATE CSE 2025 Set 2 paper. Find more GATE CSE PYQs on Intermediate Code Generation in Compiler Design, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Intermediate Code Generation PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Intermediate Code Generation in GATE CSE

Intermediate Code Generation has 14 GATE CSE PYQs across 12 papers from 2011 to 2025. 5 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2025 Set 2.

How GATE tests Intermediate Code Generation

More from GATE CSE 2025 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 2 · Q21 · MCQ

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?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.