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

Explanation

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

Q 2 - Maximum number of nodes in a binary tree with height k, where root is height 0, is

A - 2k − 1

B - 2k+1 − 1

C - 2k-1 + 1

D - 2k − 1

Answer : B

Explanation

If the root node is at height 0, then a binary tree can have at max 2k+1 − 1 nodes.

For example: a binary tree of height 1, can have maximum 21+1 − 1 = 3 nodes.

   r    --------- 0
  / \
 L   R  --------- 1

Answer : D

Explanation

Quick sort divides the list using pivot and then sorts in recursive manner. It uses divide and conquer 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 - Apriory algorithm analysis does not include −

A - Time Complexity

B - Space Complexity

C - Program Complexity

D - None of the above!

Answer : C

Explanation

Algorithms are independent of programming languages, hence, program complexity is not a part of algorithm analysis.

Answer : D

Explanation

Binary heap heapify operation has time-complexity of Ο(n), while other operations have time-complexity of Ο(1) only.

Q 7 - Which of these alogrithmic approach tries to achieve localized optimum solution −

A - Greedy approach

B - Divide and conquer approach

C - Dynamic approach

D - All of the above

Answer : A

Explanation

Greedy approach focuses only on localized optimum solution.

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 - If locality is a concern, you can use _______ to traverse the graph.

A - Breadth First Search

B - Depth First Search

C - Either BFS or DFS

D - None of the above!

Answer : B

Explanation

DFS is a better choice when locality-wise items are concerned.

Answer : B

Explanation

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

data_structures_algorithms_questions_answers.htm
Advertisements