5. In order to perform a binary search on an array, which of thefollowing must be true...
Question:
5. In order to perform a binary search on an array, which of thefollowing must be true (select all that apply)?
| The array must be ordered | |
| The array must contain integers | |
| The array must have an even number of elements | |
| The array must have an odd number of elements |
6. Command line arguments are made available to main() via anarray of _______.
7. The first action performed in a binary search is
| Determine the largest value in the array | |
| Determine the smallest value in the array | |
| Determine the mid-point of the array | |
| Determine if the array is sorted |
8. If an array contains unordered values, searching for aparticular value
| is accomplished with a linear search | |
| is accomplished with the bipolar search | |
| can't be done in Java | |
| requires multiple parallel processing threads |
9. What best describes the processing of the followingmethod?
public static int[] mystery(int[] list) {
int[] result = new int[list.length];
for (int i = 0, j = result.length -1;
i < list.length;i++, j--) {
result[j] = list[i];
}
return result;
}
| Returns an array with the values from list sorted in ascendingorder | |
| Returns an array with the values from list sorted in descendingorder | |
| Returns an array with the values from list decremented by 1 | |
| Returns an array with the values from list reversed |
10. The first action performed in Selection Sort is
| locate the midpoint of the array | |
| find the largest value in the array | |
| convert all values to integers | |
| find the smallest value in the array |
11. When Selection Sort is run against an array the end resultis
| the values in the array are reordered largest to smallest | |
| the array is unchanged because the sorted values are placed in adifferent array | |
| none of the other answers are correct | |
| the values in the array are reordered smallest to largest |
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp