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 Shimpy Goyal asked Jun 27, 2015 Shimpy Goyal 1.1k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
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. Arjun answered Jun 27, 2015 selected Dec 10, 2015 by Akash Kanase Arjun comment Share Follow See all 3 Comments See all 3 3 Comments reply Shimpy Goyal commented Jun 27, 2015 reply Follow Share y cnt use this A[i,j]= Base address +W(i-lb1)(ub2-lb2+1)+w(j-lb2) base address given i & jgiven ub given wt to take for lb?? 0 votes 0 votes Shimpy Goyal commented Jun 27, 2015 reply Follow Share kindly reply 0 votes 0 votes Arjun commented Jun 27, 2015 reply Follow Share 100 + 11 * 10 * 4 + 5 * 4 = 560. You can substitute the variables to get the formula. I always never try to study any formula :) 2 votes 2 votes Please log in or register to add a comment.
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 But yea this will only work if the options are also in that manner . Here only 560 is a multiple of 4. I know this is not the way. But i am just asking to make sure. Bipin answered Sep 29, 2015 Bipin comment Share Follow See all 2 Comments See all 2 2 Comments reply Arjun commented Sep 29, 2015 reply Follow Share You surely can given the options. It is 100% sure the other 3 are not answers. Now, either 560 or none of the choices. In both case, you will get mark if you choose 560. But this method is to be applied during GATE- not while studying :) 1 votes 1 votes Bipin commented Sep 29, 2015 reply Follow Share @Arjuin: Obviously Sir :) 0 votes 0 votes Please log in or register to add a comment.