Mixed Questions on Bubble, Selection Sort and Binary Search Set 5

This is series of all the mixed questions on Selection Sort, Bubble Sort and Binary Search Algorithms. They are shuffled in random order. These are meant for those who are preparing for a job interview, and also for those who are preparing for exams like GATE Exam. This is quiz no. 5 in this series.

Last Reviewed and Updated on February 7, 2020
Posted by Parveen(Hoven),
Aptitude Trainer and Software Developer

Quiz Questions

Each question has four choices. More than one options can be correct. When you have finished the quiz, click the button at the end of the questions to view the result, and the solutions and answers.


Your Score
Correct Answers:
Wrong Answers:
Unattempted:

Question 1

Bubble sort is used for
 A
Large lists
 B
Small lists
 C
Average size lists
 D
None
Soln.
Ans: B

Question 2

The following process depicts which sorting algorithm: first find the smallest in the array and exchange it with the element in the first position, then find the second smallest element and exchange it with the element in the second position, and continue in this way until the entire array is sorted.
 A
Selection Sort
 B
Insertion Sort
 C
Bubble Sort
 D
None
Soln.
Ans: A

Question 3

Which of the following cases doesn't exist in complexity theory?
 A
Best Case
 B
Worst Case
 C
Average Case
 D
Null Case
Soln.
Ans: D

Question 4

Which of the following sorting methods is least efficient?
 A
Insertion Sort
 B
Selection Sort
 C
Basic Bubble Sort
 D
Optimized Bubble Sort
Soln.
Ans: C

Question 5

Which of the following is not a required condition for the binary search algorithm?
 A
The list must be sorted
 B
there should be the direct access to the middle element in any sub-list
 C
There must be mechanism to delete and/or insert elements in list
 D
none of above
Soln.
Ans: C
There must be mechanism to delete and/or insert elements in list.

Question 6

Which type of data structure is used in binary search?
 A
Tree
 B
Linked List
 C
Array
 D
None of them
Soln.
Ans: C

Question 7

Which are the two principle criteria for selecting a hash function?
 A
It should be easy and quick to compute
 B
It should achieve a uniform distribution of keys in address space
 C
Both A and B
 D
None of them
Soln.
Ans: C
Two principle criteria in selecting a hash function are:
  1. It should be easy and quick to compute.
  2. It should achieve a uniform distribution of keys in address space.

Question 8

What is the purpose of the flag variable in a bubble sort?
 A
to eliminate unnecessary swaps
 B
to eliminate unnecessary comparisons
 C
to stop as soon as the list is sorted
 D
to sort an array of unknown size
Soln.
Ans: A

Question 9

Selection sort and quick sort both fall into the same category of sorting algorithms. What is this category?
 A
O(n log n) sorts
 B
Divide-and-conquer sorts
 C
Interchange sorts
 D
Average time is quadratic.
Soln.
Ans: B

Question 10

A sorting algorithm that repeatedly looks through remaining items to find the least one and moves it to its final location is
 A
Quick Sort
 B
Bubble Sort
 C
Selection Sort
 D
Merge Sort
Soln.
Ans: C

My C/C++ Videos on Youtube

Here is the complete playlist for video lectures and tutorials for the absolute beginners. The language has been kept simple so that anybody can easily understand them. I have avoided complex jargon in these videos.