1. When any ____ type (boolean, char, byte, short, int, long, float, or double)
ID: 3765677 • Letter: 1
Question
1. When any ____ type (boolean, char, byte, short, int, long, float, or double) is passed to a method, the value is passed. a. array c. element b. dummy d. primitive
2. A(n) ____ loop allows you to cycle through an array without specifying the starting and ending points for the loop control variable. a. do…while c. enhanced for b. inner d. enhanced while
3. When you perform a ____, you compare a value to the endpoints of numerical ranges to find the category in which a value belongs. a. range match c. reference b. sort d. search
4. Which of the following statements correctly declares and creates an array to hold five double scores values? 2 a. integer[] scores = new double[5] c. double[] = new scores[5] b. double[] scores = new integer[5] d. double[] scores = new double[5]
5. With a two-dimensional array, the ____ field holds the number of rows in the array. a. size c. row b. capacity d. length
6. Java provides a(n) ____ class, which contains many useful methods for manipulating arrays. a. Object c. Table b. Arrays d. Sort
7. The negative integer returned by the binarySearch() method when the value is not found is the negative equivalent of the array ____. a. type c. size b. scope d. length
8. int[][] myVals = {{2, 4, 6}, {1, 8, 9}, {1, 3, 5, 7}}; Using the above array, what is the value of myVals[1].length? a. 1 c. 3 b. 7 d. 6
Explanation / Answer
1) When any ____ type (boolean, char, byte, short, int, long, float, or double) is passed to a method, the value is passed. a. array c. element b. dummy d. primitive
Answer: primitive
2. A(n) ____ loop allows you to cycle through an array without specifying the starting and ending points for the loop control variable. a. do…while c. enhanced for b. inner d. enhanced while
Answer: enhanced for
Description: The enhanced for-loop is a popular feature introduced with the Java SE platform in version 5.0. Its simple structure allows one to simplify code by presenting for-loops that visit each element of an array/collection without explicitly expressing how one goes from element to element.
3. When you perform a ____, you compare a value to the endpoints of numerical ranges to find the category in which a value belongs. a. range match c. reference b. sort d. search
Answer : range match
4. Which of the following statements correctly declares and creates an array to hold five double scores values? a. integer[] scores = new double[5] c. double[] = new scores[5] b. double[] scores = new integer[5] d. double[] scores = new double[5]
Answer: double[] scores = new double[5]
5. With a two-dimensional array, the ____ field holds the number of rows in the array. a. size c. row b. capacity d. length.
Answer: length
Description: A two dimensional array lends itself to a visual display in rows and columns. The first index represents a row, and the second index represents a column.array.length gives only the first dimension.
6. Java provides a(n) ____ class, which contains many useful methods for manipulating arrays. a. Object c. Table b. Arrays d. Sort
Answer: Arrays
7. The negative integer returned by the binarySearch() method when the value is not found is the negative equivalent of the array ____. a. type c. size b. scope d. length
Answer: length
Description: index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
8. int[][] myVals = {{2, 4, 6}, {1, 8, 9}, {1, 3, 5, 7}}; Using the above array, what is the value of myVals[1].length? a. 1 c. 3 b. 7 d. 6
Answer: 3
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.