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

Explanation

In a min heap, parents always have lesser or equal values than that of their childs.

Q 2 - Queue data structure works on

A - LIFO

B - FIFO

C - FILO

D - none of the above

Answer : B

Explanation

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

Q 5 - Which of the following has search effeciency of Ο(1) −

A - Tree

B - Heap

C - Hash Table

D - Linked-List

Answer : C

Explanation

A simple hash table has the Ω(1) efficiency.

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.

Q 7 - Linked list search complexity is

A - Ο(1)

B - Ο(n)

C - Ο(log n)

D - Ο(log log n)

Answer : B

Explanation

Linked lists has search complexity of Ο(n).

Answer : C

Explanation

In a min heap, parent nodes store lesser values than child nodes. The minimum value of the entire heap is stored at root.

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

Answer : B

Explanation

In this analysis, actual statistics like running time and space required, are collected.

data_structures_algorithms_questions_answers.htm
Advertisements