Here are 10 essential multiple-choice questions on Java Array Programs, covering key concepts.
Question 1
What will be the output of the following program?
int[] arr = {5, 10, 15, 20, 25};
int sum = 0;
for (int num : arr) {
sum += num;
}
System.out.println(sum);
Question 3
What will be the output of the following code?
int[] arr = {3, 1, 4, 1, 5, 9};
Arrays.sort(arr);
System.out.println(arr[0]);
Question 5
What will be the output of the following program?
int[] arr = {1, 2, 3, 4, 5};
System.out.println(arr.length);
Question 7
What will be the output of the following program?
int[] arr1 = {1, 2, 3};
int[] arr2 = arr1;
arr2[0] = 10;
System.out.println(arr1[0]);
There are 10 questions to complete.
Quiz about Java Array Programs