問題詳情

第10題Given:1. import java.util.*;2. public class Quest{3. public static void main(String[] args){4. String[] colors =5. {"blue","red","green","yellow","orange"};6. Arrays.sort(colors);7. int s2 = Arrays.binarySearch(colors, "orange");8. int s3 = Arrays.binarySearch(colors, "violet");9. System.out.print(s2 + "" + s3);10. }11. }What is the result?
(A) 2-1
(B) 2-4
(C) 2-5
(D) 3-1
(E) 3-4F. 3-5G. Compilation fails.H. An exception is thrown at runtime.

參考答案

答案:C
難度:適中0.682292
統計:A(10),B(14),C(131),D(12),E(15)