• S
    SwaseekhGATE Preparation
General
  • Dashboard
  • Syllabus
  • Questions
  • Aptitude
  • Mock Tests
  • TCS NQT 2026
Account
  • Pricing
  • Contact
  1. GATE CS
  2. PYQs
  3. Computer Organization and Architecture

In the program scheme given below, indicate the instructions containing any operand needing relocation for position-independent behaviour. Justify your answer. Y = 10 MOV X(R0), R1 MOV X, R0 MOV 2(R0), R1 MOV Y(R0), R0 . . . X : WORD 0, 0, 0

GATE 1988 · Computer Organization and Architecture · Addressing Modes · medium

Answer: The instruction 'MOV X, R0' (instruction 2) needs relocation because it uses X as an absolute memory address. The other instructions use base-register + offset or immediate operands and are position-independent.

  1. Analyze MOV X(R0), R1: Here X is used as a displacement/offset constant added to R0. The absolute address is computed at runtime using R0 (which presumably already points to the data segment). This is base-register + displacement mode — no absolute address is embedded in the instruction itself.
  2. Analyze MOV X, R0: This is direct (absolute) addressing. The instruction contains the absolute memory address of symbol X. When the program is loaded at a different address, X's actual address changes, but the embedded address in this instruction does not — it must be patched (relocated).
  3. Analyze MOV 2(R0), R1 and MOV Y(R0), R0: MOV 2(R0), R1: offset is literal 2 — no symbol, no absolute address. MOV Y(R0), R0: Y=10 is an immediate constant, so EA = R0 + 10. Neither instruction embeds an absolute address.
  4. Conclusion: Only 'MOV X, R0' uses X as a direct absolute address. This is the instruction that needs relocation for position-independent behavior.