Oracle
1Z0-829 · Question #13
1Z0-829 Question #13: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-829 to reveal the answer and full explanation for question #13. The question stem and answer options stay visible for context.
Working with Arrays and Collections
Question
Given the code fragment:
List lst = new ArrayList<>();
lst.add("e1");
lst.add("e3");
lst.add("e2");
int x1 = Collections.binarySearch(lst, "e3");
System.out.println(x1);
Collections.sort(lst);
int x2 = Collections.binarySearch(lst, "e3");
System.out.println(x2);
Collections.reverse(lst);
int x3 = Collections.binarySearch(lst, "e3");
System.out.println(x3);
What is the result?
Options
- A0
- B2
- C-2
- D1
- E-1
Unlock 1Z0-829 to see the answer
You've previewed enough free 1Z0-829 questions. Unlock 1Z0-829 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Collections.binarySearch#Collections.sort#sorted collections#preconditions