Data Structures & AlgorithmsHardGATE CS · DSA

A 2-D array A[0..11][0..29] of 4-byte elements is stored in row-major order starting at address 1000. What is the address of A[5][11]?

  1. A. 1644
  2. B. 1548
  3. C. 1524
  4. D. 1648

Correct answer: A. 1644

There are 12 rows and 30 columns. In row-major order the offset is ((i − (0))·30 + (j − (0))), times 4 bytes, giving 1644. Using the other order gives 1548.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic