System.out.println(Arrays.binarySearch(os, "Mac"));
A. 0
B. 1
C. 2
D. The output is not defined.
Answer:B
System.out.println(Arrays.binarySearch(os, "Mac"));
A. 0 B. 1 C. 2 D. The output is not defined.
Explanation: The code sorts before calling binarySearch(), so it meets the precondition for that method. The target string of "Mac" is the second element in the sorted array. Since array indices begin with zero, the second position is index 1, and Option B is correct.