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

Quiz: Counting Sort and Custom Sorting · Question 10 of 13

You sort students by name, then sort the result by marks using a stable sort. What happens to students with equal marks?

You sort students by name, then sort the result by marks using a stable sort. What happens to students with equal marks?

  1. A.They end up in random order
  2. B.They are sorted by marks only, with names reversed
  3. C.They stay in name order, because a stable sort keeps the order of equal keys
  4. D.The second sort fails
Answer & explanation

Correct answer: They stay in name order, because a stable sort keeps the order of equal keys

This is how you sort by several keys in steps: least important key first.

Can you get the rest right without peeking?

Take the timed Quiz: Counting Sort and Custom Sorting quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →