(viii) Consider the following array and answer the questions given below:
int a[ ] = {12,10,8,4,6,2,3,5,7};
(a) What is the output of System.out.print(a[0] + a[5]);?
(b) What is the index (subscript) of the largest element of the array a[ ]?
Single Choice
Views 68
Answer:
Given the array:
int a[] = {12,10,8,4,6,2,3,5,7};
(a) Finding the output of System.out.print(a[0] + a[5]);
-
a[0] = 12 -
a[5] = 2 -
a[0] + a[5] = 12 + 2 = 14
Output:
14
(b) Finding the index (subscript) of the largest element in the array
The given array is:{12, 10, 8, 4, 6, 2, 3, 5, 7}
-
The largest element in the array is 12.
-
The index of
12in the array is 0.
Answer:
Index = 0
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.