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


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

Q 2 - Queue data structure works on




D - none of the above

Answer : B


In queue, data item inserted first, will be available first and data item inserted last will be available in the last. FIFO stands for First In First Out and is a correct answer.

Q 3 - The following formular is of

left_subtree (keys)  ≤  node (key)  ≤  right_subtree (keys)

A - Bianry Tree

B - Complete Binary Tree

C - Binary Search Tree

D - All of the above

Answer : C


A binary search tree (BST) is a tree in which all nodes follows the below mentioned properties −

  • The left sub-tree of a node has key less than or equal to its parent node's key.

  • The right sub-tree of a node has key greater than or equal to its parent node's key.

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

A - Ο(n)

B - Ο(n2)

C - Ο(n3)

D - None of the above

Answer : A


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

Answer : C


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

Answer : D


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

Q 7 - The Θ notation in asymptotic evaluation represents −

A - Base case

B - Average case

C - Worst case

D - NULL case

Answer : A


Θ represents average case. Ο represents worst case and Ω represents base case.

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


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

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

A - Merge Sort

B - Quick Sort

C - Insertion Sort

D - Selection Sort

Answer : B


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

Answer : B


Efficiency of algorithm is measured by assuming that all other factors e.g. processor speed, are constant and have no effect on implementation.