Question 11Asked in DSSSB TGT Computer Science (Technical), 1 Aug 2021, Shift 1

What is the condition for binary search of be unsuccessful where Beg is the beginning and End is ending location of sorted array?

  1. AEnd > Beg
  2. BEnd == Beg
  3. CEnd < Beg
  4. DEnd != Beg
Show answerHide answer

Correct answer: (C) End < Beg

Explanation

Binary search keeps narrowing Beg..End; when Beg passes End (End < Beg) the search range is empty, so the element is not present.

From DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 1

This is question 11 of DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.