Java OCA OCP Practice Question 12

Question

The java.util.Arrays class has a binarySearch(int[] arr, int key) method.

Which statements are true regarding this method?

Choose all that apply.

  • A. The method is static.
  • B. The return value is the index in the array of key.
  • C. The elements of the array must be sorted when the method is called.
  • D. After the method returns, the elements of the array are sorted, even if they weren't sorted before the call.


A, B, C.

Note

The method is static, and it returns the index of key.

The array must be sorted before the method is invoked.




PreviousNext

Related