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

Answer : A

Explanation

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

Q 2 - What data structure is used for depth first traversal of a graph?

A - queue

B - stack

C - list

D - none of the above

Answer : B

Explanation

Stack is used for depth first traversal whereas queue is used for breadth first traversal

Q 3 - The following formular is of

left_subtree (keys)  ≤  node (key)  ≤  right_subtree (keys)

A - Bianry Tree

B - Complete Binary Tree

C - Binary Search Tree

D - All of the above

Answer : C

Explanation

A binary search tree (BST) is a tree in which all nodes follows the below mentioned properties −

  • The left sub-tree of a node has key less than or equal to its parent node's key.

  • The right sub-tree of a node has key greater than or equal to its parent node's key.

Q 4 - Which of the following searching techniques do not require the data to be in sorted form

A - Binary Search

B - Interpolation Search

C - Linear Search

D - All of the above

Answer : A

Explanation

Both binary and interpolation search requires data set to be in sorted form. Linear search can work even if the data is not sorted.

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.

Q 6 - Which of the below mentioned sorting algorithms are not stable?

A - Selection Sort

B - Bubble Sort

C - Merge Sort

D - Insertion Sort

Answer : A

Explanation

Except selection sort, all other soring algorithms are stable.

Q 7 - Which of the following is not possible with an array in C programming langauge −

A - Declaration

B - Definition

C - Dynamic Allocation

D - Array of strings

Answer : C

Explanation

Array in C are static and cannot be shrinked or expanded in run-time.

Q 8 - Program with highest run-time complexity is

A - Tower of Hanoi

B - Fibonacci Series

C - Prime Number Series

D - None of the above

Answer : A

Explanation

Tower of hanoi has the highest run time complexity

Q 9 - If we choose Prim's Algorithm for uniquely weighted spanning tree instead of Kruskal's Algorithm, then

A - we'll get a different spanning tree.

B - we'll get the same spanning tree.

C - spanning will have less edges.

D - spanning will not cover all vertices.

Answer : B

Explanation

Regardless of which algorithm is used, in a graph with unique weight, resulting spanning tree will be same.

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