Arrays Quiz 1
By Mickey Arnold
starstarstarstarstarstarstarstarstarstar
Last updated 10 months ago
10 Questions
1 point
1
Question 1
1.
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[0]);
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[0]);
1 point
1
Question 2
2.
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[1]);
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[1]);
1 point
1
Question 3
3.
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[5/2]);
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[5/2]);
1 point
1
Question 4
4.
Question 4. What is output by the code below?
int[] array = {5,7,8,11,4};out.println(array[array.length-1]);
Question 4. What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[array.length-1]);
1 point
1
Question 5
5.
Question 5. What is output by the code below?
int[] array = {5,7,8,11,4};out.println(array[array.length]);
Question 5. What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[array.length]);
1 point
1
Question 6
6.
Question 6. What is output by the code below?
int[] array = {5,7,8,11,4};out.println(array.length);
Question 6. What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array.length);
1 point
1
Question 7
7.
Question 7. What is output by the code below?
int[] array = {5,7,8,11,4};for(int i=0; i<array.length/2; i=i+2){ array[i]=array[array.length-i-1];}System.out.println(array[0]);
Question 7. What is output by the code below?
int[] array = {5,7,8,11,4};
for(int i=0; i<array.length/2; i=i+2)
{
array[i]=array[array.length-i-1];
}
System.out.println(array[0]);
1 point
1
Question 8
8.
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[7/2]);
What is output by the code below?
int[] array = {5,7,8,11,4};
out.println(array[7/2]);
1 point
1
Question 9
9.
What is output by the code below?
int[] nums = new int[10];
for (int i=0; i < nums.length; i++)
{
nums[i] = i*2;
}
System.out.println(nums[5]);
What is output by the code below?
int[] nums = new int[10];
for (int i=0; i < nums.length; i++)
{
nums[i] = i*2;
}
System.out.println(nums[5]);
1 point
1
Question 10
10.
What is output by the code below?
int[] array = {5,7,8,11,4};
int sum = 0;
for(int i = 0; i<array.length; i++)
sum = sum + array[i];
System.out.println(sum);
What is output by the code below?
int[] array = {5,7,8,11,4};
int sum = 0;
for(int i = 0; i<array.length; i++)
sum = sum + array[i];
System.out.println(sum);