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 - Which one of the below is not divide and conquer approach?

A - Insertion Sort

B - Merge Sort

C - Shell Sort

D - Heap Sort

Answer : B

Explanation

Among the options, only Merge sort divides the list in sub-list, sorts and then merges them together

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.

Answer : C

Explanation

Floyd-Warshall's All pair shortest path Algorithm uses dynamic programming approach. All other mentioned algorithms use greedy programming approach

Q 4 - The minimum number of edges required to create a cyclid graph of n vertices is

A - n

B - n - 1

C - n + 1

D - 2n

Answer : A

Explanation

To make a graph cyclic, the number of edges should be at least equal to vertices in the graph.

Q 5 - Which of the below given series is Non-Increasing Order −

A - 1, 3, 4, 6, 8, 9

B - 9, 8, 6, 4, 3, 1

C - 9, 8, 6, 3, 3, 1

D - 1, 3, 3, 6, 8, 9

Answer : C

Explanation

A sequence of values is said to be in non-increasing order, if the successive element is less than or equal to its previous element in the sequence.

Answer : D

Explanation

Binary heap heapify operation has time-complexity of Ο(n), while other operations have time-complexity of Ο(1) only.

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

A - Ο(n), Ο(n)

B - Ο(n), Ο(1)

C - Ο(1), Ο(n)

D - Ο(1), Ο(1)

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 - Tower of hanoi is a classic example of

A - divide and conquer

B - recursive approach

C - B but not A

D - Both A & B

Answer : D

Explanation

The recursive approach of tower of hanoi uses divide and conquer method.

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 - 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