GATE / CS ARCHIVE

GATE CSE 1996 / QUESTION 1.16

Position-independent addressing

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

GATE 1996, Q1.16 1 mark · MCQ
Report issue

Instructions & Addressing Modes

Question 1.16, GATE 1996: Relative addressing is most relevant to writing which application: (A) coroutines, (B) position-independent code, (C) shareable code, or (D) interrupt handlers?
Question 1.16, GATE 1996: Relative addressing is most relevant to writing which application: (A) coroutines, (B) position-independent code, (C) shareable code, or (D) interrupt handlers?
Tap to enlarge
Your answer
Answer & solution

Answer: B: position-independent code (no official key was published)

A PC-relative instruction stores an offset rather than an absolute target address. Its effective target is PC plus that offset. If both instruction and target move by the same relocation amount, the difference between them is unchanged, so the stored offset still works. Absolute addressing instead embeds a location that generally needs relocation. This is why relative addressing is associated with position-independent control transfers, subject to the architecture’s offset range and exact PC convention.

Original paper, page 2