ICSE Class 10 Computer Applications Question 30 of 30

Solved 2025 Specimen Paper ICSE Class 10 Computer Applications — Question 30

Back to all questions
30
Question

Question 2(x)

Consider the following program segment and answer the questions given below:

int x[][] = { {2,4,5,6}, {5,7,8,1}, {34, 1, 10, 9}};

(a) What is the position of 34?

(b) What is the result of x[2][3] + x[1][2]?

Answer

(a) The position of 34 is x[2][0]

(b) x[2][3] + x[1][2] = 9 + 8 = 17

Explanation:

(a) Position of 34

  • The array x is a 2D array, where elements are accessed using row and column indices.
  • The element 34 is located in the 3rd row and 1st column.
  • In zero-based indexing:
    • Row index: 2
    • Column index: 0

Position: x[2][0]

(b) Result of x[2][3] + x[1][2]

Step 1: Locate x[2][3]

  • x[2][3] refers to the element in the 3rd row and 4th column.
  • Value at x[2][3] = 9.