# 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 - In a min-heap:

A - parent nodes have values greater than or equal to their childs

B - parent nodes have values less than or equal to their childs

### Answer : A

### Explanation

In a min heap, parents always have lesser or equal values than that of their childs.

Q 2 - Maximum number of nodes in a binary tree with height k, where root is height 0, is

### Answer : B

### Explanation

If the root node is at height 0, then a binary tree can have at max 2^{k+1} − 1 nodes.

For example: a binary tree of height 1, can have maximum 2^{1+1} − 1 = 3 nodes.

r --------- 0 / \ L R --------- 1

### Answer : D

### Explanation

Minimum number of queues required for priority queue implementation is two. One for storing actual data and one for storing priorities.

Q 4 - What is not true about insertion sort?

A - Exhibits the worst case performance when the initial array is sorted in reverse order.

B - Worst case and average case performance is Ο(n^{2})

C - Can be compared to the way a card player arranges his card from a card deck.

### Answer : D

### Explanation

All given options are true about insertion sort.

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 - Which of the below mentioned sorting algorithms are not stable?

### Answer : A

### Explanation

Except selection sort, all other soring algorithms are stable.

Q 7 - `node.next -> node.next.next;`

will make

### Answer : A

### Explanation

After applying `node.next -> node.next.next;`

we will not have node.next stored anywhere if not explicitly mentioned.

Q 8 - In the deletion operation of max heap, the root is replaced by

A - next available value in the left sub-tree.

B - next available value in the right sub-tree.

### Answer : D

### Explanation

Regardless of being min heap or max heap, root is always replaced by last element of the last level.

Q 9 - A balance factor in AVL tree is used to check

B - if all child nodes are at same level.

### Answer : D

### Explanation

The balance factor (BalanceFactor = height(left-sutree) − height(right-sutree)) is used to check if the tree is balanced or unbalanced.

Q 10 - Apriori analysis of an algorithm assumes that −

A - the algorithm has been tested before in real environment.

B - all other factors like CPU speed are constant and have no effect on implementation.

### Answer : B

### Explanation

Efficiency of algorithm is measured by assuming that all other factors e.g. processor speed, are constant and have no effect on implementation.