Question:medium

Match each addressing mode in List I with a data element or an element of a data structure (in a high-level language) in List II:
List IList II
P. Immediate1. Element of an array
Q. Indirect2. Pointer
R. Base with index3. Element of a record
S. Base with offset/displacement4. Constant

Show Hint

Immediate stores a constant, Indirect fetches an address which behaves like a pointer, Base+index walks arrays, and Base+displacement reaches fixed-offset record fields.
Updated On: Jul 22, 2026
  • P-4, Q-3, R-1, S-2
  • P-4, Q-2, R-1, S-3
  • P-1, Q-4, R-3, S-2
  • P-2, Q-3, R-1, S-4
Show Solution

The Correct Option is B

Solution and Explanation

Step 1: Instead of starting from the addressing modes, start from the four data elements in List II and ask which addressing mode a compiler would naturally use to reach each one.

Step 2: A constant, item 4, never lives in memory at a variable address, its value is written straight into the instruction stream, so the compiler uses Immediate addressing for it. That fixes P-4.

Step 3: A pointer, item 2, is a variable whose value is itself an address of something else. Reading through a pointer means the CPU first reads the pointer's value and then uses that value as the address of the real operand, exactly the two-hop behavior of Indirect addressing. That fixes Q-2.

Step 4: An array element, item 1, is accessed as base-of-array plus a running index that changes across loop iterations, so the compiler picks a mode built from a base register and a separate index register, i.e. Base with index. That fixes R-1.

Step 5: A record element, item 3, sits at a distance from the start of the record that is fixed once the struct layout is decided at compile time, so the compiler encodes that fixed distance as a displacement added to a base register holding the record's address, i.e. Base with offset/displacement. That fixes S-3.

Step 6: Putting P-4, Q-2, R-1, S-3 together reproduces option (B) again from the reverse direction. Any option that assigns the record element to Q or the pointer to S, such as options (A) and (D), inverts the core distinction between an address computed at compile time (record offset) and one stored as data at run time (pointer), so those options fail.

\[ \boxed{\text{Option B}} \]
Was this answer helpful?
0

Top Questions on Machine Instructions and Addressing Modes


Questions Asked in GATE CS exam