1,144 views
1 votes
1 votes
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

2 Answers

Best answer
3 votes
3 votes
A[0][0] A[0][1] A[0][2] ..... A[0][9]    -- last element starting address = 100 + 10 * 4 = 140
A[1][0] A[1][1] A[1][2] ..... A[1][9]    -- last element starting address = 100 + 80 = 180
.....
A[10][0] ...........................A[10][9]  -- last element starting address = 100 + 40 * 11 = 540
A[11][0] ... A[11][5] - address = 540 + 5*4 = 560.
selected by
1 votes
1 votes

@arjuin: sir can we do like by just looking at the options.

I mean the starting address is 100 (multiple of 4). each memory block is of size 4. So resultant memory should also be of size 4 right cheeky

But yea this will only work if the options are also in that manner wink. Here only 560 is a multiple of 4.

I know this is not the way. But i am just asking to make sure.

Related questions

2 votes
2 votes
1 answer
1