Data Structures & AlgorithmsHardTCS Digital · Infosys SP

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

  1. A. 1588
  2. B. 1592
  3. C. 1508
  4. D. 1308

Correct answer: A. 1588

There are 10 rows and 20 columns. In row-major order the offset is ((i − (0))·20 + (j − (0))), times 4 bytes, giving 1588. Using the other order gives 1308.

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

Exams that ask this topic