## 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.

Correct Answers: | |

Wrong Answers: | |

Unattempted: |

### Question 1

How many comparisons are performed in third pass of the bubble sort algorithm?

**A**

n - 2

**B**

n - 1

**C**

n - 3

**D**

None

**Soln.**

**Ans: C**

### Question 2

Which of the following signifies the average case efficiency of bubble sort algorithm?

**A**

O(n

^{2})**B**

O(2

^{n})**C**

O(n)

**D**

O(nlog n)

**Soln.**

**Ans: A**

### Question 3

In an ascending ____ sort the first element in the array is assumed to be the smallest.

**A**

bubble

**B**

swap

**C**

selection

**D**

insertion

**Soln.**

**Ans: C**

### Question 4

How many passes are required to sort an array with five elements by using the bubble sort algorithm?

**A**

5

**B**

4

**C**

1

**D**

None of the above

**Soln.**

**Ans: B**

### Question 5

Which is the following algorithm -

- Repeat step 2 and 3 varying j from 0 to n-2 //Repeat for n-1 passes
- Find the index of the minimum value in arr[j] to arr[n-1]
- Set min_index=j
- Repeat step c varying i from j+1 to n-1
- If arr[i]<arr[min_index]: Min_index=i

- swap arr[j] with arr[min_index]

**A**

Insertion Sort

**B**

Bubble Sort

**C**

Selection Sort

**D**

None

**Soln.**

**Ans: C**

### Question 6

In which of the following hashing techniques, you apply a second hash function in case of a collision

**A**

Double Hashing

**B**

Quadratic probing

**C**

Linear Probing

**D**

Separate Probing

**Soln.**

**Ans: A**

Double Hashing

### Question 7

In binary search algorithm, after every search operation, the search gets reduced by____________?

**A**

1/2

**B**

1/3

**C**

1/4

**D**

1/6

**Soln.**

**Ans: C**

In binary search algorithm, after every search operation, the search gets reduced by 1/4.

### Question 8

Ideally efficiency of hashing is:

**A**

O(1)

**B**

O(n)

**C**

O(n log n)

**D**

O(log n)

**Soln.**

**Ans: A**

Ideally efficiency of hashing is O(1)

### Question 9

To Implement _________ Search algorithm, the list should be sorted

**A**

Binary Search

**B**

Both

**C**

Linear Search

**D**

none of them

**Soln.**

**Ans: A**

Binary Search algorithm is based on the preceding approach for searching an item in a sorted list.

### Question 10

What is the worst case performance of binary search?

**A**

O(n log n)

**B**

O(log n)

**C**

O(1)

**D**

O(n)

**Soln.**

**Ans: B**

The worst case performance of binary search is O(log n).

## 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.