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.

1.

How many types of insertion are performed in a binary tree?

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

What is the time complexity for splitting the string into two new string in the rope data structure?

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

Which algorithm is used in the top tree data structure?

A. Divide and Conquer
B. Greedy
C. Backtracking
D. Branch
Answer» B. Greedy
4.

What is the time complexity of level order traversal?

A. O(1)
B. O(n)
C. O(logn)
D. O(nlogn)
Answer» C. O(logn)
5.

What is the time complexity for maintaining a dynamic set of weighted trees?

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

Self – balancing binary search trees have a much better average-case time complexity than hash tables.

A. True
B. False
Answer» C.
7.

The size value of various nodes in a weight balanced tree are leaf – zero internal node – size of it's two children is this true?

A. true
B. false
Answer» B. false
8.

How many edges are present in path cluster?

A. 2
B. 3
C. 6
D. 1
Answer» B. 3
9.

What must be the ideal size of array if the height of tree is 'l'?

A. 2l-1
B. l-1
C. l
D. 2l
Answer» B. l-1
10.

Which process forms the randomized binary search tree?

A. Stochastic Process
B. Branching Process
C. Diffusion Process
D. Aggregation Process
Answer» B. Branching Process
11.

The steps for finding post-order traversal are traverse the right subtree, traverse the left subtree or visit the current node.

A. True
B. False
Answer» C.
12.

How many edges are present in Edge cluster?

A. 0
B. 1
C. 2
D. 4
Answer» C. 2
13.

For how many vertices in a set, is top tree defined for underlying tree?

A. 3
B. 4
C. 5
D. 2
Answer» E.
14.

What is the maximum number of children that a binary tree node can have?

A. 0
B. 1
C. 2
D. 3
Answer» D. 3
15.

What is the space complexity of a treap algorithm?

A. O(N)
B. O(log N)
C. O(log N)
D. O(N2)
Answer» B. O(log N)
16.

What is the worst case analysis of an AA-Tree?

A. O(N)
B. O(log N)
C. O( N log N)
D. O(N2)
Answer» C. O( N log N)
17.

Consider a situation of writing a binary tree into a file with memory storage efficiency in mind, is array representation of tree is good?

A. yes because we are overcoming the need of pointers and so space efficiency
B. yes because array values are indexable
C. No it is not efficient in case of sparse trees and remaning cases it is fine
D. No linked list representation of tree is only fine
Answer» D. No linked list representation of tree is only fine
18.

Which data structure is used to maintain a dynamic forest using a link or cut operation?

A. Top Tree
B. Array
C. Linked List
D. Stack
Answer» B. Array
19.

How many edges does a leaf cluster contain?

A. 0
B. 1
C. 2
D. 3
Answer» B. 1
20.

What is the time complexity of pre-order traversal in the iterative fashion?

A. O(1)
B. O(n)
C. O(logn)
D. O(nlogn)
Answer» C. O(logn)
21.

Balanced binary tree with n items allows the lookup of an item in ____ worst-case time.

A. O(log n)
B. O(nlog 2)
C. O(n)
D. O(1)
Answer» B. O(nlog 2)
22.

What is the disadvantage of using splay trees?

A. height of a splay tree can be linear when accessing elements in non decreasing order.
B. splay operations are difficult
C. no significant disadvantage
D. splay tree performs unnecessary splay when a node is only being read
Answer» B. splay operations are difficult
23.

What is the time complexity for creating a new node and then performing concatenation in the rope data structure?

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

AA-Trees makes more rotations than a red-black tree.

A. True
B. False
Answer» B. False
25.

What is the average running time of a treap?

A. O(N)
B. O(N log N)
C. O(log N)
D. O(M log N)
Answer» D. O(M log N)
26.

What is the time complexity for deleting the string to form a new string in the rope data structure?

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

A binary tree is a rooted tree but not an ordered tree.

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

Of the following rules that are followed by an AA-tree, which of the following is incorrect?1- Only right children can be red2- Procedures are coded recursively3- Instead of storing colors, the level of a node is stored4- There should not be any left children

A. 1
B. 2
C. 3
D. 4
Answer» E.
29.

In which of the following self – balancing binary search tree the recently accessed element can be accessed quickly?

A. AVL tree
B. AA tree
C. Splay tree
D. Red – Black tree
Answer» D. Red – Black tree
30.

Which operation is used to break a preferred path into two sets of parts at a particular node?

A. Differentiate
B. Cut
C. Integrate
D. Join
Answer» C. Integrate
31.

What are the conditions for an optimal binary search tree and what is its advantage?

A. The tree should not be modified and you should know how often the keys are accessed, it improves the lookup cost
B. You should know the frequency of access of the keys, improves the lookup time
C. The tree can be modified and you should know the number of elements in the tree before hand, it improves the deletion time
D. None of the mentioned
Answer» B. You should know the frequency of access of the keys, improves the lookup time
32.

What is the parent for a node 'w' of a complete binary tree in an array representation when w is not 0?

A. floor(w-1/2)
B. ceil(w-1/2)
C. w-1/2
D. w/2
Answer» B. ceil(w-1/2)
33.

How many different shapes does maintenance of AA-Tree need to consider?

A. 7
B. 5
C. 2
D. 3
Answer» D. 3
34.

The maximum number of nodes in a tree for which post-order and pre-order traversals may be equal is ______

A. 3
B. 1
C. 2
D. any number
Answer» C. 2
35.

How many top trees are there in a tree with single vertex?

A. 0
B. 1
C. 2
D. 3
Answer» B. 1
36.

How many orders of traversal can be applied to a binary tree?

A. 1
B. 4
C. 2
D. 3
Answer» E.
37.

Which of the following is a self – balancing binary search tree?

A. 2-3 tree
B. Threaded binary tree
C. AA tree
D. Treap
Answer» D. Treap
38.

Is Treap a randomized tree.

A. True
B. False
Answer» B. False
39.

Which type of binary search tree or algorithm does tango tree use?

A. Online
B. Offline
C. Static
D. Dynamic
Answer» E.
40.

The post-order traversal of a binary tree is O P Q R S T. Then possible pre-order traversal will be ________

A. T Q R S O P
B. T O Q R P S
C. T Q O P S R
D. T Q O S P R
Answer» D. T Q O S P R
41.

Which of the below statements are true i.Cartesian tree is not a height balanced tree ii.Cartesian tree of a sequence of unique numbers can be unique generated

A. both statements are true
B. only i. is true
C. only ii. is true
D. both are untrue
Answer» B. only i. is true
42.

What are the worst case and average case complexities of a binary search tree?

A. O(n), O(n)
B. O(logn), O(logn)
C. O(logn), O(n)
D. O(n), O(logn)
Answer» E.
43.

What is the priority of a null node?

A. 1
B. 0
C. random number
D. infinity
Answer» E.
44.

Which special balanced binary search tree is used to store the nodes of auxiliary tree?

A. Red - Black Tree
B. Red - Brown Tree
C. Red - Yellow Tree
D. Red - Tango Tree
Answer» B. Red - Brown Tree
45.

If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?

A. 2i+1
B. 2i+2
C. 2i
D. 4i
Answer» B. 2i+2
46.

Why to prefer red-black trees over AVL trees?

A. Because red-black is more rigidly balanced
B. AVL tree store balance factor in every node which costs space
C. AVL tree fails at scale
D. Red black is more efficient
Answer» C. AVL tree fails at scale
47.

Which type of binary search tree is imitated for construction of tango tree?

A. Complete Binary Search Tree
B. Perfect Binary Search Tree
C. Balanced Binary Search Tree
D. Degenerate Binary Search Tree
Answer» B. Perfect Binary Search Tree
48.

What is the time complexity for the update cost on auxiliary trees?

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

In a full binary tree if number of internal nodes is I, then number of nodes N are?

A. N = 2I
B. N = I + 1
C. N = I – 1
D. N = 2I + 1
Answer» E.
50.

Which of the following is the correct definition for a horizontal link?

A. connection between node and a child of equal levels
B. connection between two nodes
C. connection between two child nodes
D. connection between root node and leaf node
Answer» B. connection between two nodes