Machine-translated by Google. Questions are authored in English.
Top

Discussion

What will be the address of the arr[2][3] if arr is a 2-D long array of 4 rows and 5 columns and starting address of the array is 2000?

  • A.2048
  • B.2056
  • C.2052
  • D.2042

Answer: C

Correct answer: 2052

With 5 columns and 4 bytes per element, row-major gives

\[ 2000 + 4\,(2 \times 5 + 3) = 2000 + 4 \times 13 = 2052 \]

The row count, 4, does not enter the calculation - only the number of columns matters, because that is how far one row-step moves you.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.