Data Structures Algorithms Online Quiz


Advertisements


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 - In order traversal of binary search tree will produce −

A - unsorted list

B - reverse of input

C - sorted list

D - none of the above

Answer : C

Explanation

Binary search tree yields a sorted list when traversed in-order.

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.

Answer : C

Explanation

Floyd-Warshall's All pair shortest path Algorithm uses dynamic programming approach. All other mentioned algorithms use greedy programming approach

Q 4 - Visiting root node after visiting left and right sub-trees is called

A - In-order Traversal

B - Pre-order Traversal

C - Post-order Traveral

Answer : C

Explanation

In Post-order traversal method, the root node is visited last, hence the name.

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 - A queue data-structure can be used for −

A - expression parsing

B - recursion

C - resource allocation

D - all of the above

Answer : C

Explanation

Queues can be used for limited resource allocation. For other operations, stacks are used.

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 - Re-balancing of AVL tree costs

A - Ο(1)

B - Ο(log n)

C - Ο(n)

D - Ο(n2)

Answer : B

Explanation

AVL rotations have complexity of Ο(log n)

Answer : B

Explanation

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


data_structures_algorithms_questions_answers.htm

Advertisements