Arrays Quiz 2
By Mickey Arnold
starstarstarstarstarstarstarstarstarstar
Last updated 10 months ago
11 Questions
7 points
7
Question 1
1.
What is the output of System.out.println(vals[0]) on line 1?
What is the output of System.out.println(vals[0]) on line 1?
7 points
7
Question 2
2.
What is the output of System.out.println(vals[2]) on line 2?
What is the output of System.out.println(vals[2]) on line 2?
7 points
7
Question 3
3.
What is the output of System.out.println(vals[5]) on line 3?
What is the output of System.out.println(vals[5]) on line 3?
7 points
7
Question 4
4.
What is the output of System.out.println(vals.length) on line 4?
What is the output of System.out.println(vals.length) on line 4?
7 points
7
Question 5
5.
What is the output of System.out.println(vals[1+5]) on line 5?
What is the output of System.out.println(vals[1+5]) on line 5?
7 points
7
Question 6
6.
What is the output of System.out.println(vals[10/3]) on line 6?
What is the output of System.out.println(vals[10/3]) on line 6?
7 points
7
Question 7
7.
What is the output of System.out.println(vals[2*2]) on line 7?
What is the output of System.out.println(vals[2*2]) on line 7?
7 points
7
Question 8
8.
What is the output of System.out.println(vals[0] + vals[1]) on line 8?
What is the output of System.out.println(vals[0] + vals[1]) on line 8?
7 points
7
Question 9
9.
What is the output of System.out.println(vals[1] + vals[4]) on line 9?
What is the output of System.out.println(vals[1] + vals[4]) on line 9?
7 points
7
Question 10
10.
What is the output of System.out.println(vals.length/2) on line 10?
What is the output of System.out.println(vals.length/2) on line 10?
30 points
30
Question 11
11.
Run method description: 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 less than 5 in the array one. The call run([3,4,5,6,7,8,9,-2]) would return 5.
Run method description: 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 less than 5 in the array one. The call run([3,4,5,6,7,8,9,-2]) would return 5.