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 - Postfix expression is just a reverse of prefix expression.

A - True

B - False

Answer : B

Explanation

Expression notations are not reverse (or so) of each other, rather operators used in the expression have different arrangements.

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.

Answer : C

Explanation

As trees do not have loops, they are easier to traverse.

Q 6 - How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4}

A - 4

B - 5

C - 6

D - 7

Answer : A

Explanation

There will be 3 swaps in first iteration and 1 swap in second iteration.

Answer : A

Explanation

After applying node.next -> node.next.next; we will not have node.next stored anywhere if not explicitly mentioned.

Answer : B

Explanation

Recursion uses stack but the main reason is, every recursive call needs to be stored separately in the memory.

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

Explanation

A stable sorting algorithm like bubble sort, does not change the sequence of appearance of similar element in the sorted list.

data_structures_algorithms_questions_answers.htm
Advertisements