Question 273 of 481
1Z0-811 Arrays and Methods Practice Question
A developer needs to search an unsorted array of 100,000 customer IDs (int) for a specific ID. Which approach is most efficient for a single search?
⚠ Common exam trap
Oracle often tests the misconception that binary search is always faster, but candidates forget that binary search requires a sorted array and that sorting itself adds cost, making linear search more efficient for a single unsorted search.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Iterate through the array and compare each element
A linear search (iterating through the array and comparing each element) is the most efficient approach for a single search on an unsorted array. It has O(n) time complexity and requires no preprocessing, which is optimal when you only need to find one element once.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use Arrays.binarySearch() directly on the unsorted array
Why it's wrong here
Binary search requires sorted input; results are undefined.
- ✓
Iterate through the array and compare each element
Why this is correct
Linear search has O(n) time, optimal for a single search on unsorted data.
- ✗
First sort the array using Arrays.sort(), then use binary search
Why it's wrong here
Sorting is O(n log n) which is worse than one linear scan.
- ✗
Convert the array to a HashSet and then search
Why it's wrong here
Conversion overhead and memory usage; not needed for one search.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 30, 2026
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.