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

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 2

The efficiency of the selection sort algorithm is same as that of the bubble sort algorithm.

**A**

False

**B**

True

**C**

Depends on List

**D**

None

**Soln.**

**Ans: B**

True, because both have same order of growth.

### Question 3

Which of these are the main properties to consider in a bubble sort?

**A**

Stable and O(1) extra space

**B**

O(n

^{2}) comparisons and swaps**C**

Adaptive: O(n) when nearly sorted

**D**

All of them

**Soln.**

**Ans: D**

### Question 4

To apply binary search algorithm, you should ensure that the list to be searched is___________

**A**

Unsorted

**B**

Partially sorted

**C**

Sorted

**D**

all of them

**Soln.**

**Ans: C**

To apply binary search algorithm, you should ensure that the list to be searched is

*sorted*list.### Question 5

Which of these is not a problem of the bubble sort? [More than one can be correct]

**A**

Turtle

**B**

Bat

**C**

Cat

**D**

Rabbit

**Soln.**

**Ans: BC**

### Question 6

The given code is an example of which of the following sorting algorithm:

int s,t, numItems = 10; for(s=(numItems - 1); s>=0; s--) { for(t=1;t<=s;t++) { if(arr[t-1]>arr[t]) { temp=arr[t-1]; arr[t-1]=arr[t]; arr[t]=temp; } } }

**A**

Selection Sort

**B**

Bubble Sort

**C**

Shell Sort

**D**

None

**Soln.**

**Ans: B**

### Question 7

A selection sort compares adjacent elements, and swaps them if they are in the wrong order.

**A**

True

**B**

False

**C**

Depends on Elements

**D**

None of the above

**Soln.**

**Ans: B**

### Question 8

In hashing, conversion of the key to an address is done by a relation, which is known as ?

**A**

Hashing relation

**B**

Formula

**C**

Hashing Function

**D**

None of them

**Soln.**

**Ans: C**

In hashing, conversion of the key to an address is done by a relation, which is known as a Hashing Function

### Question 9

Two main measures for the efficiency of an algorithm are:

**A**

Processor and Memory

**B**

Complexity and Capacity

**C**

Time and Space

**D**

Data and Space

**Soln.**

**Ans: C**

### Question 10

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

**A**

0

**B**

5

**C**

4

**D**

1

**Soln.**

**Ans: C**

4 because (n-1) passes is required where n=5

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