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.

Questions and Answers

Q 1 - A procedure that calls itself is called

A - illegal call

B - reverse polish

C - recursive

D - none of the above

Answer : C

Explanation

In recursion, a procedure calls itself, either directly or by calling a procedure which in turn calls it.

Q 2 - Postfix expression is just a reverse of prefix expression.

A - True

B - False

Answer : B

Explanation

Expression notations are not reverse (or so) of each other, rather operators used in the expression have different arrangements.

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

A - Fibonacci Series

B - Tower of Hanoi

C - Dijkstra Shortest Path

D - All of the above

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 5 - Which method can find if two vertices x & y have path between them?

A - Depth First Search

B - Breadth First Search

C - Both A & B

D - None A or B

Answer : C

Explanation

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

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

A - size of array

B - pivot element

C - sequence of values

D - none of the above!

Answer : B

Explanation

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

Answer : C

Explanation

Remembering the results of previously calculated solutions is called memoization.

Answer : A

Explanation

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

Q 9 - Re-balancing of AVL tree costs

A - Ο(1)

B - Ο(log n)

C - Ο(n)

D - Ο(n2)

Answer : B

Explanation

AVL rotations have complexity of Ο(log n)

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

A - linear search

B - binary search

C - merge sort

D - quick sort

Answer : A

Explanation

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

data_structures_algorithms_questions_answers.htm
Advertisements