# MCQ IN COMPUTER SCIENCE & ENGINEERING

## COMPUTER SCIENCE AND ENGINEERING

### ALGORITHMS

 Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A bubble sort goes through each pair in a list and swaps them if not in order.
 A True B False C Either A or B D None of the above
Explanation:

Detailed explanation-1: -Bubble sort is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

Detailed explanation-2: -The correct answer is option 3. Concept: Bubble Sort is the most basic sorting algorithm, and it operates by periodically exchanging nearby components if they are out of order.

Detailed explanation-3: -Problem : What would happen if bubble sort didn’t keep track of the number of swaps made on each pass through the list? The algorithm wouldn’t know when to terminate as it would have no way of knowing when the list was in sorted order.

Detailed explanation-4: -The algorithm needs one whole pass without any swap to know it is sorted.

Detailed explanation-5: -Bubble Sort is a sorting algorithm that works by first sorting the items into two piles, and then swapping the items in each pile until they are sorted in reverse order. This process is known as the First Iteration of Bubble Sort.

There is 1 question to complete.