Log in
Sign up for FREE
arrow_back
Library

Arrays Quiz

star
star
star
star
star
Last updated about 2 years ago
11 questions
8
8
8
8
8
8
8
8
8
8
20
Question 1
1.

Question 2
2.

Question 3
3.

Question 4
4.

Question 5
5.

Question 6
6.

Question 7
7.

Question 8
8.

Question 9
9.

Question 10
10.

Question 11
11.

Write a return method named run that returns an integer. run takes in one parameter which is an array of integers named one. run will return the sum of all values greater than 5 in the array one . The call run([3,4,5,6,7,8,9]) would return 30. Type your answer in the show your work box.

What is output by the code below?

int[] array = {5,7,8,11,4};
out.println( array[0] );
There is no output due to a syntax error.
7
11
5
There is no output due to a runtime exception.
What is output by the code below?

int[] array = {5,7,8,11,4};
out.println( array[1] );
There is no output due to a runtime exception.
There is no output due to a syntax error.
5
11
7
What is output by the code below?

int[] array = {5,7,8,11,4};
out.println( array[5/2] );
8
7
There is no output due to a syntax error.
There is no output due to a runtime exception.
5
What is output by the code below?

int[] array = {5,7,8,11,4};
out.println(array[array.length-1]);
8
There is no output due to a runtime exception.
4
There is no output due to a syntax error.
11
What is output by the code below?

int[] array = {5,7,8,11,4};
out.println(array[array.length]);
11
4
8
There is no output due to a runtime exception.
There is no output due to a syntax error.
What is output by the code below?

int[] array = {5,7,8,11,4};
out.println(array.length);
5
3
2
4
1
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]);
7
11
4
8
5
What is output by the code below?

int[] array = {5,7,8,11,4};
out.println(array[7/2]);
There is no output due to a syntax error.
5
11
8
There is no output due to a runtime exception.
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]);
12
14
18
10
16
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);
28
There is no output due to a syntax error.
35
21
There is no output due to a runtime error.