Professional Documents
Culture Documents
9 Arrays
9 Arrays
Mcq
a[i] = i;
a[j] = j;
a[k] = k;
int sum = 0;
for(int l = 0; l < a.length; l++)
{
sum += a[l];
}
System.out.println("Sum = " + sum);
}
}
Mcq
A. Objects
B. Object references
C. Primitive data type
D. None of the above
Answer : A
QUESTION 02
Answer: A
QUESTION 03
Answer : C
QUESTION 07
What will be the order of the array elements at the end of the program?
class Main A. 12
{
public static void main(String 15
s[]) 16
{ 17
int a[] = {12, 15, 16, 17, 19
19}; B. 12
for(int i = 0; i < 5; i++) 15
{ 16
System.out.println(a[i]); 17 Answer: A
} C. 15
} 16
}
17
19
D. Compilation
error
QUESTION 12
What will be the output of the following program?
class Main int sum = 0;
{ A. Sum=20
public static void for(int l = 0; l < B. Sum=30
main(String s[]) a.length; l++)
{ { C. Sum=40
int a[] = new sum += a[l]; D. Compilation error
int[50]; }