ICSE Class 10 Computer Applications Question 58 of 59

Arrays — Question 9

Back to all questions
9
Question

Question 9

Given that int z[ ][ ] = {{2, 6, 5}, {8, 3, 9}}; What will be value of z[1][0] and z[0][2] ?

  1. 2 and 9
  2. 8 and 5
  3. 2 and 5
  4. 6 and 3
Answer

8 and 5

Reason — Two-dimensional arrays are stored in a row-column matrix, where the first index indicates the row and the second indicates the column.

The element stored at z[1][0] refers to the element stored in second row and first column, which is 8.

The element stored at z[0][2] refers to the element stored in first row and third column, which is 5.