In computer architecture, which addressing mode provides access to an operand at an address defined relative to the start of the data structure in which it resides?
-
Aascending
-
Bsorting
-
Cindex
-
Dindirect
-
ENone of the above
Answer
Correct Answer: index
Explanation
Introduction / Context:Addressing modes specify how the CPU computes the effective address of an operand. They are essential for working with arrays, records/structs, and tables. Correctly identifying an addressing mode helps in understanding how compilers layout data and how instructions fetch operands at runtime.
Given Data / Assumptions:
- The operand's location is relative to the beginning of a data structure.
- The interest is in a mode that naturally supports offsets within a structure or array.
- Terminology aligns with standard ISA descriptions (index, indirect, etc.).
Concept / Approach:
Index addressing uses a base address (often the start of a data structure) plus an index or offset to calculate the effective address: EA = base + index. This maps directly onto array indexing and field offsets. Indirect addressing dereferences a pointer but does not by itself add a structure-relative offset unless combined with indexing.
Step-by-Step Solution:
Interpret the phrase 'relative to the beginning of the data structure' as base + offset.Identify the mode that adds an index to a base: index addressing.Validate that indirect addressing uses a pointed-to address without structured offset semantics.Select 'index' as the correct addressing mode.Verification / Alternative check:
Common ISAs (x86 base+index+disp, ARM base+offset) implement index addressing for arrays and struct fields, reinforcing the choice.
Why Other Options Are Wrong:
- ascending/sorting: algorithmic terms, not addressing modes.
- indirect: dereferences a pointer; alone it does not encode structure-relative indexing.
- None of the above: incorrect because index addressing matches exactly.
Common Pitfalls:
- Confusing indirect with indexed-indirect modes; the presence of an offset is key.
Final Answer:
index.