🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Sorting, heapq and bisect: all 10 questions

Quiz: Sorting, heapq and bisect · Question 9 of 10

What happens if you call bisect on an unsorted list?

What happens if you call bisect on an unsorted list?

  1. A.It raises ValueError
  2. B.It sorts the list first
  3. C.It returns a position without error, but the answer may be wrong
  4. D.It falls back to a linear search
Answer & explanation

Correct answer: It returns a position without error, but the answer may be wrong

bisect assumes the list is sorted and does not check.

Can you get the rest right without peeking?

Take the timed Quiz: Sorting, heapq and bisect quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →