# 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 run-time complexity of binary search algorithm?

### Answer : D

### Explanation

In the worst case, binary search will be left or right intended, making it compare all the n values.

Q 2 - Stack is used for

### Answer : C

### Explanation

Recursive procedures use stacks to execute the result of last executed procedural call.

Q 3 - Which of the following is an example of dynamic programming approach?

### Answer : D

### Explanation

All mentioned use dynamic programming approach. Before solving the in-hand sub-problem, dynamic algorithm will try to examine the results of previously solved sub-problems. The solutions of sub-problems are combined in order to achieve the best solution.

Q 4 - Binary search tree has best case run-time complexity of Ο(log n). What could the worst case?

### Answer : A

### Explanation

In case where binary search tree is left or right intended, the worst case can be Ο(n)

Q 5 - Which of the following has search effeciency of Ο(1) −

### Answer : C

### Explanation

A simple hash table has the Ω(1) efficiency.

Q 6 - Quick sort running time depends on the selection of

### Answer : B

### Explanation

If the pivot element is balanced, quick sort running time will be less.

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 - In C programming, when we remove an item from bottom of the stack, then −

### Answer : B

### Explanation

Stack can only be accessed from top of it.

Q 9 - A pivot element to partition unsorted list is used in

### Answer : B

### Explanation

The quick sort partitions an array using pivot element and then calls itself recursively twice to sort the resulting two subarray.

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.