What value does binary search return if the target element is not present in the sorted array?
Null
Index where the element should be inserted
-1
It depends on the implementation
What is the time complexity of Binary Search in the best-case scenario?
O(1)
O(log n)
O(n log n)
O(n)
When searching for a value in a very large sorted array, which algorithm is generally more efficient?
Linear search
Binary search
What happens if the target element is not present in the array during Binary Search?
It enters an infinite loop.
It returns -1.
It throws an exception.
It returns the index where the element should be inserted.
You have an unsorted array, and you need to find a specific value. Is it more efficient to sort the array and then use binary search, or to directly apply linear search?
Sort and then use binary search
Directly use linear search
What is the primary difference between Binary Search and Interpolation Search?
Binary Search is faster than Interpolation Search in all cases.
Binary Search requires more memory than Interpolation Search.
Binary Search always divides the array in half, while Interpolation Search estimates the position of the target element.
Binary Search only works on sorted arrays, while Interpolation Search can work on unsorted arrays.
Which of the following best describes the advantage of binary search over linear search?
Binary search is easier to implement.
Binary search can be used on unsorted data.
Binary search uses less memory.
Binary search has a faster average-case time complexity.
You need to find the first occurrence of a target value in a sorted array with duplicates. Which algorithm is more efficient?
Can binary search be used to efficiently search for a target value in a rotated sorted array?
It depends on the pivot point of the rotated array.
No, binary search is not applicable to rotated sorted arrays.
Yes, but it requires modifications to handle the rotation.
Yes, binary search can be directly applied.
If you need to perform frequent insertions or deletions in the middle of a dataset, is binary search the most suitable choice?
Yes
No