GATE CS 2025 Set 2 | Question 21

Compiler Design › Intermediate Code & Code Optimization · MCQ · 1 mark · Answer: C

  1. Question 21Compiler Designmcq1 mark
    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 expressions 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?
    • A.
      Only (I) is correct.
    • B.
      Only (II) is correct.
    • C.
      Both (I) and (II) are correct.
      ✓
    • D.
      Neither (I) nor (II) is correct.

    Answer: C

    Solution

    Answer: (C) Both (I) and (II) are correct. Backpatching keeps lists of incomplete jump targets and fills them in once the target label is known. This lets a compiler generate code for Boolean expressions (true/false exit jumps) and for flow-of-control statements (if-else, while) in a single pass. Both (I) and (II) hold.

More GATE PYQ on Intermediate Code & Code Optimization

All GATE CS Compiler Design PYQ →

Attempt GATE CS 2025 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →