# Data Structures Algorithms Online Quiz

Following quiz provides Multiple Choice Questions (MCQs) related to **Data Structures Algorithms**. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using **Show Answer** button. You can use **Next Quiz** button to check new set of questions in the quiz.

Q 1 - What is the worst case time complexity of linear search algorithm?

### Answer : D

### Explanation

Linear search scans sequentially to find the target value. The best case is Ο(1) and average and worst case is Ο(n). Worst case is when data is not in the list, and it has to scan all n elements.

### Answer : C

### Explanation

Stack uses push() to insert an item in stack, and pop() to remove the top item from stack.

Q 3 - Minimum number of moves required to solve a *Tower of Hanoi* puzzle is

### Answer : C

### Explanation

Minimum number of moves required to solve a Tower of Hanoi puzzle is 2^{n} - 1. Where n is the number of disks. If the number of disks is 3, then minimum number of moves required are 2^{3} - 1 = 7

Q 4 - Maximum degree of any vertex in a simple graph of vertices n is

### Answer : D

### Explanation

In a simple graph, a vertex can have edge to maximum n - 1 vertices.

Q 5 - Which method can find if two vertices x & y have path between them?

### Answer : C

### Explanation

By using both BFS and DFS, a path between two vertices of a connected graph can be determined.

Q 6 - How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4}

### Answer : A

### Explanation

There will be 3 swaps in first iteration and 1 swap in second iteration.

Q 7 - Which of the following is not possible with an array in C programming langauge −

### Answer : C

### Explanation

Array in C are static and cannot be shrinked or expanded in run-time.

Q 8 - Recursion uses more memory space than iteration because

A - it uses stack instead of queue.

### Answer : B

### Explanation

Recursion uses stack but the main reason is, every recursive call needs to be stored separately in the memory.

Q 9 - Binary search tree is an example of complete binary tree with special attributes.

A - BST does not care about complete binary tree properties.

B - BST takes care of complete binary tree properties.

### Answer : A

### Explanation

BST does not care about complete binary tree properties.

Q 10 - Which of the following algorithm does not divide the list −

### Answer : A

### Explanation

Linear search, seaches the desired element in the target list in a sequential manner, without breaking it in any way.