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 - What data structure is used for breadth first traversal of a graph?

A - queue

B - stack

C - list

D - none of the above

Answer : A

Explanation

Queue is used for breadth first traversal whereas stack is used for depth first traversal.

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

Explanation

Fibonacci Series generates subsequent number by adding two previous numbers.

Q 4 - Maximum degree of any vertex in a simple graph of vertices n is

A - 2n - 1

B - n

C - n + 1

D - n - 1

Answer : D

Explanation

In a simple graph, a vertex can have edge to maximum n - 1 vertices.

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.

Q 6 - Time required to merge two sorted lists of size m and n, is

A - Ο(m | n)

B - Ο(m + n)

C - Ο(m log n)

D - Ο(n log m)

Answer : B

Explanation

The time required to merge two sorted list is Ο(m + n).

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

Answer : D

Explanation

Regardless of being min heap or max heap, root is always replaced by last element of the last level.

Answer : D

Explanation

The balance factor (BalanceFactor = height(left-sutree) − height(right-sutree)) is used to check if the tree is balanced or unbalanced.

Answer : A

Explanation

For this algorithm to work properly the data collection should be in sorted form and equally distributed.

data_structures_algorithms_questions_answers.htm
Advertisements