232k views
4 votes
Consider a multidimensional array A stored in row-major order with 22 rows and 6 columns whose subscripts start at 0. If each element occupies eight bytes, then how many bytes from the start address of A will element A[3, 5] be stored? a. 284 b. 136 c. 184d. 568

User Nabdreas
by
4.9k points

1 Answer

2 votes

Answer:

Option c is the correct answer for the above question.

Step-by-step explanation:

  • If the array will store in row-major order, then it will be a store like the first row, then second row and then third row.
  • If the user wants to conclude the address of the A[3,5], then the address of the A[3,5] will be 184.
  • It is because the 3 states the row number and the 5 states the column number.
  • The above question states that every value take 8 bit. and there are 4 rows from 0 to 3 and 6 column (0 to 5) for every row (except the fourth rows because it takes 5 columns from 0 to 4) before the A[3,5].
  • So there are 23 value before A[3,5] which are as-- [00,01,02,03,04,05][10,11,12,13,14,15][20,21,22,23,24,25][30,31,32,33,34].
  • So when every value takes 8 bit then 23 value takes 184 bits(23*8).
  • So the address of A[3,4] is 184.
  • Hence option c is the correct and the other is not because of 184 stated from the c option only.
User LightStruk
by
4.9k points