GATE / CS ARCHIVE

GATE CSE 2004 / QUESTION 20

Relocation-friendly addressing modes

Computer Organization & Architecture · Instructions & Addressing Modes · Full GATE CSE 2004 paper

GATE 2004, Q20 1 mark · MCQ
Report issue

Instructions & Addressing Modes

Question 20, GATE 2004: Which addressing modes support program relocation at runtime? (i) Absolute; (ii) Based; (iii) Relative; (iv) Indirect.
Options:
(A) i and iv
(B) i and ii
(C) ii and iii
(D) i,ii and iv
Question 20, GATE 2004: Which addressing modes support program relocation at runtime? (i) Absolute; (ii) Based; (iii) Relative; (iv) Indirect.
Options:
(A) i and iv
(B) i and ii
(C) ii and iii
(D) i,ii and iv
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Base addressing forms an address as relocation base plus displacement, while PC-relative addressing uses a displacement from the moving instruction location. Both preserve relative positions when code is relocated, so ii and iii, C.

2. Absolute embedded addresses require adjustment; indirection alone does not guarantee that stored pointer values relocate correctly.

3. Teaching check: If relocation shifts all code by Δ, a PC-relative target shifts with the PC while its displacement stays fixed. A base-addressed target shifts when the base register is updated. An arbitrary indirect pointer can still contain an obsolete absolute address, so indirection alone is not a relocation guarantee.

Original paper, page 3