Consider the following numList:
8 7 13 1 -9 4
Sequence the following output obtained after each pass of comparison using bubble sort.
(A) 7 8 1 -9 4 13
(B) 7 1 -9 4 8 13
(C) -9 1 4 7 8 13
(D) 1 -9 4 7 8 13
Consider the following numList:
| 8 | 7 | 13 | 1 | -9 | 4 |
|---|
Sequence the following output obtained after each pass of comparison using bubble sort.
(A) 7 8 1 -9 4 13
(B) 7 1 -9 4 8 13
(C) -9 1 4 7 8 13
(D) 1 -9 4 7 8 13
Solution
✅ Correct Option: 3
Bubble sort compares adjacent pairs from left to right in each pass and swaps them if they are out of order, so the largest remaining element moves to the end.
Pass 1: becomes (A)
Pass 2: (A) becomes (B)
Pass 3: (B) becomes (D)
Pass 4: (D) becomes (C)
Options 1 and 4: (C) is the fully sorted list, so it must come last. (D) still has before , so it comes just before (C).
Related questions:
2025: 3 June Shift 2
2025: 27 May Shift 2
2026: 26 May Shift 1
2026: 13 May Shift 2
2026: 21 May Shift 1