Data Structures & AlgorithmsHardGATE CS · competitive programming

A 10×20 array A[1..10][1..20] is stored column-major. The base address is 1000 and each element takes 8 bytes. What is the address of A[4][7]?

  1. A. 1528
  2. B. 1504
  3. C. 1592
  4. D. 1512

Correct answer: B. 1504

Column-major: address = base + ((j − 1)·rows + (i − 1))·size = 1000 + (60 + 3)·8 = 1504. The row-major address would be 1528.

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

Exams that ask this topic