Data Structures & AlgorithmsHardCognizant · Capgemini pattern

Only the lower triangle (including the diagonal) of a 10 × 10 matrix is stored, row by row, in a 1-D array starting at address 2000, with 2 bytes per element and indices from 0. What is the address of element [6][4]?

  1. A. 2048
  2. B. 2056
  3. C. 2050
  4. D. 2128

Correct answer: C. 2050

Rows 0–5 hold 1 + 2 + … + 6 = 21 elements, then 4 more in row 6: offset 25 elements × 2 bytes = 50, so 2050. Using full rows (6 × 10 + 4 = 64 → 2128) ignores the triangular storage.

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

Exams that ask this topic