Multiple choice technology programming languages

What will be the outcome of line no. 9 in the following program ? 1. public class SearchArray { 2. public static void main(String[] args) { 3. String[] strArr = {"one","two","three","four","five","six","seven"}; 4. boolean[] boolArr = {true,false,false,true,false}; 5. int[] intArr = {22,11,66,99}; 6. Arrays.sort(intArr); 7. for(int n=0; n

  1. -3

  2. 3

  3. -4

  4. 4

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The array intArr initially contains {22, 11, 66, 99}. After calling Arrays.sort(intArr), it becomes sorted: {11, 22, 66, 99}. Searching for 67 using Arrays.binarySearch yields an insertion point of index 3 (between 66 and 99). The return value is key insertion point index negated minus 1, which calculates to -(3) - 1 = -4.