Question 49

Computer Awareness Searching Hard

The following integers are needed to be stored in ascending order using bubble sort.

5, 8, 22, 18, 1
Following are the results of various passes during the sorting process. Which among them is final pass

(A) \( 5,1,8,18,22 \)
(B) \( 1,5,8,18,22 \)
(C) \( 5,8,18,1,22 \)
(D) \( 5,8,1,18,22 \)
✓ Correct Answer: Option B Verified Solution

📘 Step-by-Step Solution & Detailed Explanation:

Let's apply the Bubble Sort algorithm step by step on the given list:
Given array: \[ 5, 8, 22, 18, 1 \] Pass 1
- Compare 5 and 8 → No swap
- Compare 8 and 22 → No swap
- Compare 22 and 18 → Swap → 5, 8, 18, 22, 1
- Compare 22 and 1 → Swap → 5, 8, 18, 1, 22

Pass 2:
- Compare 5 and 8 → No swap
- Compare 8 and 18 → No swap
- Compare 18 and 1 → Swap → 5, 8, 1, 18, 22
- 22 is in its final position

Pass 3:
- Compare 5 and 8 → No swap
- Compare 8 and 1 → Swap → 5, 1, 8, 18, 22

Pass 4:
- Compare 5 and 1 → Swap → 1, 5, 8, 18, 22

Final Sorted Order: \[ 1, 5, 8, 18, 22 \]
Correct Answer:
Option B: \( 1, 5, 8, 18, 22 \)

Practice Similar Searching Questions

Reinforce your conceptual grasp with related questions from CUET-MCA 2024:

Q1 Which one of the following data structures are preferred in database...
Solve →
Q5 \[ |l l| List - I & List - II \\ (A) Asynchronous & (II) The operation is...
Solve →
Q6 Consider a system with 1 K pages and 512 frames and each page is of size 2...
Solve →
Q8 Each node is having a successor node in \( \) :
Solve →
Q9 How does the number of page frames affect and number of page faults for a...
Solve →
Full-Length Test Series

Prepare for CUET-MCA Under Real Exam Conditions

Take timed full-length mock tests with authentic question distributions, negative marking (+12/-3 in Math), and instant All India Rank calculation.

Start Free Mock Test Series →