Arrays Quiz 2
star
star
star
star
star
Last updated over 1 year ago
11 questions

7
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
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
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
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
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
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
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
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
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
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
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.