🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Searching and Sorting in C: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What must be true before you can use binary search?
  2. Q2. At most how many comparisons does binary search need for 1,000 sorted elements?
  3. Q3. What does this print? (code)
  4. Q4. Which sort makes the same number of comparisons whether the input is sorted or not?
  5. Q5. What is the best-case time of insertion sort, and when does it happen?
  6. Q6. Why write mid = low + (high - low) / 2 instead of (low + high) / 2?
  7. Q7. What does this print? (code)
  8. Q8. What does "stable sort" mean?
  9. Q9. What is the main advantage of selection sort?
  10. Q10. In insertion sort, why must the condition be j = 0 && a[j] key in that order?