The __________ method copies the sourceArray to the targetArray.
A. System.arrayCopy(sourceArray, 0, targetArray, 0, sourceArray.length);
B. System.arraycopy(sourceArray, 0, targetArray, 0, sourceArray.length);
C. System.copyArrays(sourceArray, 0, targetArray, 0, sourceArray.length);
D. System.copyarrays(sourceArray, 0, targetArray, 0, sourceArray.length);
查看答案
For the binarySearch method in Section 7.10.2, what is low and high after the first iteration of the while loop when invoking binarySearch(new int[]{1, 4, 6, 8, 10, 15, 20}, 11)?
A. low is 0 and high is 6
B. low is 5 and high is 5
C. low is 6 and high is 5
D. low is 5 and high is 4
Use the selectionSort method presented in this section to answer this question. Assume list is {3.1, 3.1, 2.5, 6.4, 2.1}, what is the content of list after the first iteration of the outer loop in the method?
A. 2.5, 3.1, 3.1, 6.4, 2.1
B. 3.1, 3.1, 2.5, 2.1, 6.4
C. 3.1, 3.1, 2.5, 6.4, 2.1
D. 2.1, 3.1, 2.5, 6.4, 3.1
Which of the following are valid array declarations?
A. char[] charArray = new char[26];
B. int[] words = new words[10];
C. double[3] nums = {3.5, 35.1, 32.0};
D. char[] charArray = "Computer Science";
In the following code, what is the printout for list2? public class Test {public static void main(String[] args) {int[] list1 = {1, 2, 3};int[] list2 = {1, 2, 3};list2 = list1;list1[0] = 0; list1[1] = 1; list2[2] = 2; for (int i = 0; i < list2.length; i++)System.out.print(list2[i] + " ");} }
A. 0 1 3
B. 1 1 1
C. 0 1 2
D. 1 2 3