Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 133 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.

51.

What should be the condition for the level of a left node?

A. It should be less than or equal to that of its parent
B. It should be greater than that of its parent
C. It should be strictly less than that of its parent
D. The level should be equal to one
Answer» D. The level should be equal to one
52.

What is the range of β in finding the length of the longest path in a randomized binary search tree?

A. (-1, 0)
B. (1, 0)
C. (0, 5)
D. (0, 1)
Answer» E.
53.

Which of the following is correct with respect to binary trees?

A. Let T be a binary tree. For every k ≥ 0, there are no more than 2k nodes in level k
B. Let T be a binary tree with λ levels. Then T has no more than 2λ - 1 nodes
C. Let T be a binary tree with N nodes. Then the number of levels is at least ceil(log (N + 1))
D. All of the mentioned
Answer» E.
54.

A treap is a combination of a tree and a heap.

A. false
B. true
Answer» C.
55.

What is the upper bound for a tango tree if k is a number of interleaves?

A. k+2 O (log (log n))
B. k O (log n)
C. K2 O (log n)
D. k+1 O (log (log n))
Answer» E.
56.

Which of the following tree data structures is not a balanced binary tree?

A. AVL tree
B. Red-black tree
C. Splay tree
D. B-tree
Answer» E.
57.

Is insertion and deletion operation faster in rope than an array?

A. True
B. False
Answer» B. False
58.

What is the expected depth of a node in a randomized binary search tree?

A. log n
B. n!
C. n2
D. 2 log n + O(1)
Answer» E.
59.

The balance factor of a node in a binary tree is defined as _____

A. addition of heights of left and right subtrees
B. height of right subtree minus height of left subtree
C. height of left subtree minus height of right subtree
D. height of right subtree minus one
Answer» D. height of right subtree minus one
60.

Is tango tree represented as a tree of trees.

A. True
B. False
Answer» B. False
61.

Can a tree stored in an array using either one of inorder or post order or pre order traversals be again reformed?

A. yes just traverse through the array and form the tree
B. No we need one more traversal to form a tree
C. No in case of sparse trees
D. None of the mentioned
Answer» C. No in case of sparse trees
62.

The binary tree sort implemented using a self – balancing binary search tree takes ______ time is worst case.

A. O(n log n)
B. O(n)
C. O(n2)
D. O(log n)
Answer» B. O(n)
63.

The following lines talks about deleting a node in a binary tree.(the tree property must not be violated after deletion)i) from root search for the node to be deletedii)iii) delete the node at what must be statement ii) and fill up statement iii)

A. ii)-find random node,replace with node to be deleted. iii)- delete the node
B. ii)-find node to be deleted. iii)- delete the node at found location
C. ii)-find deepest node,replace with node to be deleted. iii)- delete a node
D. ii)-find deepest node,replace with node to be deleted. iii)- delete the deepest node
Answer» E.
64.

Which of the following is an advantage of balanced binary search tree, like AVL tree, compared to binary heap?

A. insertion takes less time
B. deletion takes less time
C. searching takes less time
D. construction of the tree takes less time than binary heap
Answer» B. deletion takes less time
65.

Which of the following are used as an internal operation in Top tree?

A. Merge
B. Cut
C. Expose
D. Link
Answer» B. Cut
66.

Several other operations like union set difference and intersection can be done in treaps.

A. True
B. False
Answer» B. False
67.

What is the longest length path for a node x in random binary search tree for the insertion process?

A. log x
B. x2
C. x!
D. 4.311 log x
Answer» D. 4.311 log x
68.

Which of the following is not the self balancing binary search tree?

A. AVL Tree
B. 2-3-4 Tree
C. Red – Black Tree
D. Splay Tree
Answer» C. Red – Black Tree
69.

Which type of tree is tango tree?

A. Ternary Tree
B. AVL Tree
C. Binary Search Tree
D. K-ary Tree
Answer» D. K-ary Tree
70.

Which operation is used to combine two auxiliary trees?

A. Join
B. Combinatorial
C. Add
D. Concatenation
Answer» B. Combinatorial
71.

Comparing the speed of execution of Red-Black trees and AA-trees, which one has the faster search time?

A. AA-tree
B. Red-Black tree
C. Both have an equal search time
D. It depends
Answer» B. Red-Black tree
72.

When to choose Red-Black tree, AVL tree and B-trees?

A. many inserts, many searches and when managing more items respectively
B. many searches, when managing more items respectively and many inserts respectively
C. sorting, sorting and retrieval respectively
D. retrieval, sorting and retrieval respectively
Answer» B. many searches, when managing more items respectively and many inserts respectively
73.

How many common operations are performed in a binary tree?

A. 1
B. 2
C. 3
D. 4
Answer» D. 4
74.

Which of the following is also known as Rope data structure?

A. Cord
B. String
C. Array
D. Linked List
Answer» B. String
75.

What is the time complexity for the initialization of top tree?

A. O (n)
B. O (n2)
C. O (log n)
D. O (n!)
Answer» B. O (n2)
76.

Which is the simplest of all binary search trees?

A. AVL tree
B. Treap
C. Splay tree
D. Binary heap
Answer» C. Splay tree
77.

Which type of binary tree does rope require to perform basic operations?

A. Unbalanced
B. Balanced
C. Complete
D. Full
Answer» C. Complete
78.

Which of the following trees is similar to that of an AA-Tree?

A. Splay Tree
B. B+ Tree
C. AVL Tree
D. Red-Black Tree
Answer» E.
79.

General ordered tree can be encoded into binary trees.

A. true
B. false
Answer» B. false
80.

How will you remove a left horizontal link in an AA-tree?

A. by performing right rotation
B. by performing left rotation
C. by deleting both the elements
D. by inserting a new element
Answer» B. by performing left rotation
81.

Is Top tree used for maintaining Dynamic set of trees called forest.

A. True
B. False
Answer» B. False
82.

Which of the following data structures can be efficiently implemented using height balanced binary search tree?

A. sets
B. priority queue
C. heap
D. both sets and priority queue
Answer» E.
83.

To obtain a prefix expression, which of the tree traversals is used?

A. Level-order traversal
B. Pre-order traversal
C. Post-order traversal
D. In-order traversal
Answer» C. Post-order traversal
84.

What is the time complexity of for achieving competitive ratio by tango tree?

A. O (log n)
B. O (n2)
C. O (n!)
D. O (log (log n))
Answer» E.
85.

What is the expected number of leaves in a randomized binary search tree?

A. n + 1
B. (n + 1)/3
C. (n + 1)/2
D. n + 3
Answer» C. (n + 1)/2
86.

The minimum height of self balancing binary search tree with n nodes is _____

A. log2(n)
B. n
C. 2n + 1
D. 2n – 1
Answer» B. n
87.

What is the time complexity for inserting the string and forming a new string in the rope data structure?

A. O (log n)
B. O (n!)
C. O (n2)
D. O (1)
Answer» B. O (n!)
88.

A full binary tree can be generated using ______

A. post-order and pre-order traversal
B. pre-order traversal
C. post-order traversal
D. in-order traversal
Answer» B. pre-order traversal
89.

What is the prime condition of AA-tree which makes it simpler than a red-black tree?

A. Only right children can be red
B. Only left children can be red
C. Right children should strictly be black
D. There should be no left children
Answer» B. Only left children can be red
90.

Which type of data structure does rope represent?

A. Array
B. Linked List
C. Queue
D. Binary Tree
Answer» E.
91.

After applying the below operations on a input sequence, what happens? i. construct a cartesian tree for input sequence ii. put the root element of above tree in a priority queue iii. if( priority queue is not empty) then .search and delete minimum value in priority queue .add that to output .add cartesian tree children of above node to priority queue

A. constructs a cartesian tree
B. sorts the input sequence
C. does nothing
D. produces some random output
Answer» C. does nothing
92.

What is the reason behind the simplicity of a treap?

A. Each node has data and a pointer
B. Each node is colored accordingly
C. It is a binary search tree following heap principles
D. Each node has a fixed priority field
Answer» E.
93.

AVL trees are more balanced than Red-black trees.

A. True
B. False
Answer» B. False
94.

Which of the following is a random tree?

A. Treap
B. Random Binary Tree
C. Uniform Spanning Tree
D. All of the mentioned
Answer» E.
95.

In a binary search tree, which of the following traversals would print the numbers in the ascending order?

A. Level-order traversal
B. Pre-order traversal
C. Post-order traversal
D. In-order traversal
Answer» E.
96.

Cartesian trees solve range minimum query problem in constant time

A. true
B. false
Answer» B. false
97.

Associative arrays can be implemented using __________

A. B-tree
B. A doubly linked list
C. A single linked list
D. A self balancing binary search tree
Answer» E.
98.

Why do we impose restrictions like . root property is black . every leaf is black . children of red node are black . all leaves have same black

A. to get logarithm time complexity
B. to get linear time complexity
C. to get exponential time complexity
D. to get constant time complexity
Answer» B. to get linear time complexity
99.

What is the condition for priority of a node in a treap?

A. a node's priority should be greater than its parent
B. a node's priority should be at least as large as its parent
C. the priority is randomly assigned and can have any value
D. a node's priority is always given in decreasing order
Answer» C. the priority is randomly assigned and can have any value
100.

Who invented treaps?

A. Cecilia and Raimund
B. Arne Andersson
C. Donald Shell
D. Harris and Ross
Answer» B. Arne Andersson