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

Answer : B


At maximum, a complete graph can have nn - 1 spanning trees.

Q 2 - Which one of the below mentioned is linear data structure −

A - Queue

B - Stack

C - Arrays

D - All of the above

Answer : D


All mentioned data structures are linear in nature.

Q 3 - The following formula will produce

Fn = Fn-1 + Fn-2

A - Armstrong Number

B - Fibonacci Series

C - Euler Number

D - Prime Number

Answer : B


Fibonacci Series generates subsequent number by adding two previous numbers.

Q 4 - Minimum number of spanning tree in a connected graph is

A - n

B - nn - 1

C - 1

D - 0

Answer : C


Every connected graph at least has one spanning tree.

Q 5 - Time complexity of Depth First Traversal of is

A - Θ(|V|+|E|)

B - Θ(|V|)

C - Θ(|E|)

D - Θ(|V|*|E|)

Answer : A


Using Depth First Search, we traverse the whole graph i.e. visiting all Vertices and Edges.

Q 6 - How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4}

A - 4

B - 5

C - 6

D - 7

Answer : A


There will be 3 swaps in first iteration and 1 swap in second iteration.

Q 8 - Program with highest run-time complexity is

A - Tower of Hanoi

B - Fibonacci Series

C - Prime Number Series

D - None of the above

Answer : A


Tower of hanoi has the highest run time complexity

Q 9 - The following sorting algorithms maintain two sub-lists, one sorted and one to be sorted −

A - Selection Sort

B - Insertion Sort

C - Merge Sort

D - both A &am; B

Answer : D


Both selection sort and insertion sort maintains two sublists and then checks unsorted list for next sorted element.

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


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