Searching Algorithms: Binary Search - Problem Set

Download Q&A
Q. If the array is [1, 2, 3, 4, 5] and we search for 6, what will be the final result of binary search?
  • A. 0
  • B. -1
  • C. 5
  • D. 4
Q. If the array is [2, 3, 4, 10, 40] and we are searching for 10, what is the first mid index calculated in binary search?
  • A. 0
  • B. 2
  • C. 3
  • D. 1
Q. What happens if the target value is not present in the array during binary search?
  • A. Returns the index of the closest value
  • B. Returns -1
  • C. Returns the last mid index
  • D. Infinite loop
Q. What is the effect of using binary search on a linked list?
  • A. Faster than array
  • B. Slower than array
  • C. Same as array
  • D. Not applicable
Q. What is the mid index formula used in binary search?
  • A. (low + high) / 2
  • B. (high - low) / 2
  • C. (low + high) / 2 + 1
  • D. (low + high) / 2 - 1
Showing 1 to 5 of 5 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely