Searching Algorithms: Binary Search - Implementations in C++

Download Q&A
Q. In a binary search algorithm, what happens if the target is less than the mid value?
  • A. Search the right half
  • B. Search the left half
  • C. Return the mid index
  • D. Increase the mid index
Q. In a binary search implementation, what is the purpose of the 'mid' variable?
  • A. To store the maximum value
  • B. To find the middle index
  • C. To count iterations
  • D. To store the minimum value
Q. What will be the result of binary search if the target element is not present in the array?
  • A. Returns the index of the closest element
  • B. Returns -1
  • C. Returns the size of the array
  • D. Returns the first element
Showing 1 to 3 of 3 (1 Pages)
Soulshift Feedback ×

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

Not likely Very likely