Data Structures & AlgorithmsHardProduct-company MCQ pattern

LSD radix sort (base 10, stable counting sort per digit) is applied to [170, 45, 75, 90, 802, 24, 2, 66]. What is the array after the FIRST pass (units digit)?

  1. A. 2 24 45 66 75 90 170 802
  2. B. 170 90 2 802 24 45 75 66
  3. C. 802 2 24 45 66 170 75 90
  4. D. 170 90 802 2 24 45 75 66

Correct answer: D. 170 90 802 2 24 45 75 66

Group by units digit in the original order: 0 → 170, 90; 2 → 802, 2; 4 → 24; 5 → 45, 75; 6 → 66. Stability keeps 802 before 2 (and 170 before 90), so 2 802 is wrong; 802 2 24 … is the result after the second (tens) pass.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic