# 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 - For a binary search algorithm to work, it is necessary that the array (list) must be

### Answer : A

### Explanation

As binary search divides the list and selects a the sub-list to extend search based on comparison of values, it becomes necessary that the array (list) must be in sorted form.

Q 2 - What data structure can be used to check if a syntax has balanced paranthesis ?

### Answer : D

### Explanation

Stack uses LIFO method which is good for checking matching paranthesis.

Q 3 - Which of the following asymptotic notation is the worst among all?

### Answer : B

### Explanation

Ο(n+9378) is n dependent

Ο(n^{3}) is cubic

n^{Ο(1)} is polynomial

2^{Ο(n)} is exponential

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 - After each iteration in bubble sort

A - at least one element is at its sorted position.

### Answer : A

### Explanation

In one iteration of Bubble sort, the maximum of the set in hand is moved at the end of the unsorted list. Hence one less comparison.

Q 6 - The number of binary trees with 3 nodes which when traversed in post order gives the sequence A,B,C is ?

### Answer : C

### Explanation

Five binary trees (of 3 nodes) are possible.

Q 7 - If queue is implemented using arrays, what would be the worst run time complexity of queue and dequeue operations?

### Answer : D

### Explanation

As queue is maintained by two separate pointers for queue and dequeue operations, the run time for both is Ο(1).

Q 8 - Heap is an example of

### Answer : A

### Explanation

Heap maintains itself to meet all the requirements of complete binary tree.

Q 9 - If locality is a concern, you can use _______ to traverse the graph.

### Answer : B

### Explanation

DFS is a better choice when locality-wise items are concerned.

Q 10 - Project scheduling is an example of

### Answer : B

### Explanation

Project scheduling is an exmaple of dynamic programming.