What does the following output?
String[] os = new String[] { "Mac", "Linux", "Windows" }; System.out.println(Arrays.binarySearch(os, "Linux"));
D.
Java requires having a sorted array before calling binarySearch.
Since the array is not sorted, the result is undefined, and Option D is correct.
It may happen that you get 1 as the result, but this behavior is not guaranteed.
You need to know for the exam that this is undefined even if you happen to get the "right" answer.