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 of the following usees FIFO method

A - Queue

B - Stack

C - Hash Table

D - Binary Search Tree

Answer : A

Explanation

Queue maintains two pointers − front and rear. In queue data structure, the item inserted first will always be removed first, hence FIFO!

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

Explanation

All mentioned data structures are linear in nature.

Q 3 - Minimum number of queues required for priority queue implementation?

A - 5

B - 4

C - 3

D - 2

Answer : D

Explanation

Minimum number of queues required for priority queue implementation is two. One for storing actual data and one for storing priorities.

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

Explanation

In one iteration of Bubble sort, the maximum of the set in hand is moved at the end of the unsorted list. Hence one less comparison.

Q 6 - In binary heap, whenever the root is removed then the rightmost element of last level is replaced by the root. Why?

A - It is the easiest possible way.

B - To make sure that it is still complete binary tree.

C - Because left and right subtree might be missing.

D - None of the above!

Answer : B

Explanation

A binary heap (whether max or min) has to satisfy the property of complete binary tree at all times.

Q 7 - The Θ notation in asymptotic evaluation represents −

A - Base case

B - Average case

C - Worst case

D - NULL case

Answer : A

Explanation

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

Q 8 - If there's no base criteria in a recursive program, the program will

A - not be executed.

B - execute until all conditions match.

C - execute infinitely.

D - obtain progressive approach.

Answer : C

Explanation

Without a base criteria and progressive approach, a recursion is just an infinite iteration.

Answer : A

Explanation

Shell sort uses insertion sort when interval value is 1.

Answer : B

Explanation

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

data_structures_algorithms_questions_answers.htm
Advertisements