(ix)
(a) Write the Java statement to initialize the first 6 odd numbers in a 3 × 2 array.

(b) What is the result of x[0][1] + x[2][1] of the above array?

Single Choice
Views 60

Answer:

(a) Java statement to initialize the first 6 odd numbers in a 3 × 2 array:


int[][] x = {
    {1, 3},
    {5, 7},
    {9, 11}
};

(b) Calculation of x[0][1] + x[2][1]:

  • x[0][1] refers to the element at row 0, column 1, which is 3.

  • x[2][1] refers to the element at row 2, column 1, which is 11.

Result:
x[0][1] + x[2][1] = 3 + 11 = 14

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of ICSE Computer Applications Class 10 – Previous Year Question Papers & Solutions, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.