Consider an array A[20, 10], assume 4 words per memory cell and the base…
2014
Consider an array A[20, 10], assume 4 words per memory cell and the base address of array A is 100. What is the address of A[11, 5] ? Assume row major storage.
- A.
560
- B.
565
- C.
570
- D.
575
Attempted by 894 students.
Show answer & explanation
Correct answer: A
Key formula: Address = base + ((row_index * number_of_columns) + column_index) * element_size
Given: base address = 100; dimensions = 20 rows, 10 columns; element size = 4 bytes (given as 4 words per memory cell).
Assumption: indices are zero-based (so row_index = 11 and column_index = 5 mean i = 11, j = 5).
Compute offset = (11 * 10 + 5) * 4 = 115 * 4 = 460.
Final address = base + offset = 100 + 460 = 560.
Therefore the address of A[11, 5] (row-major, zero-based indexing) is 560.