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 - In order traversal of binary search tree will produce −

A - unsorted list

B - reverse of input

C - sorted list

D - none of the above

Answer : C

Explanation

Binary search tree yields a sorted list when traversed in-order.

Q 2 - What data structure is used for depth first traversal of a graph?

A - queue

B - stack

C - list

D - none of the above

Answer : B

Explanation

Stack is used for depth first traversal whereas queue is used for breadth first traversal

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

A - Ο(n+9378)

B - Ο(n3)

C - nΟ(1)

D - 2Ο(n)

Answer : B

Explanation

Ο(n+9378) is n dependent

Ο(n3) is cubic

nΟ(1) is polynomial

2Ο(n) is exponential

Q 4 - Which of the following algorithm is not stable?

A - Bubble Sort

B - Quick Sort

C - Merge Sort

D - Insertion Sort

Answer : B

Explanation

Among the given, only quick sort is not stable that is it may re-arrange the already sorted items.

Answer : C

Explanation

An algorithm is a step by step procedure to solve a computer problem.

Q 6 - Time required to merge two sorted lists of size m and n, is

A - Ο(m | n)

B - Ο(m + n)

C - Ο(m log n)

D - Ο(n log m)

Answer : B

Explanation

The time required to merge two sorted list is Ο(m + n).

Answer : C

Explanation

Remembering the results of previously calculated solutions is called memoization.

Q 8 - Which of the following algorithm cannot be desiged without recursion −

A - Tower of Hanoi

B - Fibonacci Series

C - Tree Traversal

D - None of the above

Answer : D

Explanation

Every problem which can be solved using recursion can also be solved using iterations.

Q 9 - Access time of a binary search tree may go worse in terms of time complexity upto

A - Ο(n2)

B - Ο(n log n)

C - Ο(n)

D - Ο(1)

Answer : C

Explanation

At maximum, BST may need to search all n values in the tree in order to access an element, hence, Ο(n).

Q 10 - If the data collection is in sorted form and equally distributed then the run time complexity of interpolation search is −

A - Ο(n)

B - Ο(1)

C - Ο(log n)

D - Ο(log (log n))

Answer : D

Explanation

Runtime complexity of interpolation search algorithm is Ο(log (log n)) as compared to Ο(log n) of BST in favourable situations.

data_structures_algorithms_questions_answers.htm
Advertisements