Which of the following addressing mode is best suited to access elements of an…
2017
Which of the following addressing mode is best suited to access elements of an array of contiguous memory locations ?
- A.
Indexed addressing mode
- B.
Base Register addressing mode
- C.
Relative address mode
- D.
Displacement mode
Attempted by 150 students.
Show answer & explanation
Correct answer: A
Answer: Indexed addressing mode
How it works: The effective address is computed as a base address plus the value in an index register (often with optional scaling by element size). For the i-th element of an array, the address is base + i * element_size.
Advantages for arrays: Allows efficient traversal by incrementing the index register, directly maps high-level array indexing to hardware, and often supports scaled indexing so element size is handled automatically.
Why other modes are less suitable: Base register or displacement addressing access fixed offsets from a base and are better for fixed fields or stack/frame references; relative addressing is PC-relative and used mainly for branches or position-independent references. None of these are as naturally suited to repeated indexed access of contiguous array elements as indexed addressing.
A video solution is available for this question — log in and enroll to watch it.