Which of the following is a prerequisite for using binary search on a dataset?
The data must be stored in a linked list.
The data must contain only numerical values.
The data must be stored in a hash table.
The data must be sorted.
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.
Yes, but it requires modifications to handle the rotation.
No, binary search is not applicable to rotated sorted arrays.
Yes, binary search can be directly applied.
Which of the following is a key difference between the iterative and recursive approaches to binary search?
Recursive binary search can only be used on arrays, while iterative binary search can be used on any data structure.
Iterative binary search is generally more efficient.
Iterative binary search uses a loop, while recursive binary search uses function calls.
Recursive binary search uses a loop, while iterative binary search uses function calls.
Which of the following best describes the time complexity of binary search in the average case?
O(1)
O(n log n)
O(log n)
O(n)
What value does binary search return if the target element is not present in the sorted array?
Null
-1
It depends on the implementation
Index where the element should be inserted
What is the primary difference between Binary Search and Interpolation Search?
Binary Search requires more memory than Interpolation Search.
Binary Search only works on sorted arrays, while Interpolation Search can work on unsorted arrays.
Binary Search is faster than Interpolation Search in all cases.
Binary Search always divides the array in half, while Interpolation Search estimates the position of the target element.
How do you calculate the middle index in Binary Search to avoid potential overflow?
mid = left / 2 + right / 2
mid = (left + right) / 2
mid = left + (right - left) / 2
mid = (left + right + 1) / 2
You have a sorted array that has been rotated an unknown number of times. Which algorithm is best suited for finding a specific element in this array?
Linear Search
Jump Search
Binary Search
Interpolation Search
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?
Directly use linear search
Sort and then use binary search
In the context of Binary Search, what is the problem with searching in an infinitely sized array?
Binary Search is too slow for infinitely sized arrays.
Binary Search cannot handle duplicate elements in an infinitely sized array.
Binary Search cannot handle arrays with no defined end.
Binary Search requires the entire array to be loaded into memory.