Skip to content
Official PYQ · 2001

GATE CS 2001 Q2.9 — Machine Instructions and Addressing Modes

Explain with AI

Which is the most appropriate match for the items in the first column with the items in the second column:X.Indirect AddressingI.Array implementationY.Indexed AddressingII.Writing relocatable codeZ.Base Register AddressingIII.Passing array as parameter\begin{array}{|cl|cl|} \hline \text{X.} &\text{Indirect Addressing} & \text{I.} &\text{Array implementation} \\ \hline \text{Y.} &\text{Indexed Addressing} & \text{II.} &\text{Writing relocatable code} \\ \hline \text{Z.} &\text{Base Register Addressing} & \text{III.} &\text{Passing array as parameter}\\ \hline \end{array}

Choose one option
View worked solution

Answer: A

To find the correct match, let us analyze the purpose of each addressing mode:

  1. Indirect Addressing (X → III): When an array is passed as a parameter to a function, we typically pass a pointer (the base address of the array). Accessing the array elements inside the function is done by dereferencing this pointer, which is implemented using indirect addressing (pointer-based access).
  2. Indexed Addressing (Y → I): In indexed addressing, the effective address is calculated as: Effective Address=Base Address+Index Register\text{Effective Address} = \text{Base Address} + \text{Index Register} This is the standard mechanism used for array implementation, where the base address of the array is constant and the index register is varied to access different elements (e.g., A[i]A[i]).
  3. Base Register Addressing (Z → II): In base register addressing, the effective address is calculated as: Effective Address=Base Register+Displacement\text{Effective Address} = \text{Base Register} + \text{Displacement} The base register holds the starting address of the program segment in memory. If the program is relocated to a different memory location, only the base register needs to be updated, while the instruction offsets (displacements) remain unchanged. Thus, it is ideal for writing relocatable code.

Therefore, the correct matching is (X, III), (Y, I), (Z, II), which corresponds to Option A.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Machine Instructions and Addressing Modes questions