Data Structures & AlgorithmsHardGATE CS · DSA

A 2-D array A[0..11][0..29] of 2-byte elements is stored in column-major order starting at address 2000. What is the address of A[9][6]?

  1. A. 2164
  2. B. 2552
  3. C. 2162
  4. D. 2138

Correct answer: C. 2162

There are 12 rows and 30 columns. In column-major order the offset is ((j − (0))·12 + (i − (0))), times 2 bytes, giving 2162. Using the other order gives 2552.

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

Exams that ask this topic