Computer Sciences > GATE 2025 SET-2 > Code Generation
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?
A
Only (I) is correct.
B
Only (II) is correct.
C
Both (I) and (II) are correct.
D
Neither (I) nor (II) is correct.

Correct : c

Backpatching is a technique used in compiler intermediate code generation to handle forward jumps when target addresses are not known initially. It allows these addresses to be filled in ("backpatched") later, so code generation can proceed in one pass.

Statement (I): Backpatching allows code generation for Boolean expressions (like those in conditional statements) in one pass, by linking together jump instructions whose targets aren’t known until later.

Statement (II): Backpatching also enables code generation for flow-of-control statements (such as if, while, for) in one pass, by managing jumps for control transfers.

Therefore, both statements are correct.

✅ Final Answer: Option (c) — Both (I) and (II) are correct.

Reason: Backpatching is used for both Boolean expressions and flow-of-control statements so that intermediate code can be generated efficiently in a single pass.

Similar Questions

Consider the following statements. S1: The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S2: The sequence of proce...
#811 MCQ
Consider the following statements. S1: The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S2: The sequence of proce...
#811 MCQ
Consider the following statements. S1: The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S2: The sequence of proce...
#811 MCQ

Related Topics

No tags found

Unique Visitor Count

Total Unique Visitors

Loading......