250+ TOP MCQs on Top Tree and Answers

Data Structures & Algorithms Multiple Choice Questions on “Top Tree”.

1. Which algorithm is used in the top tree data structure?
a) Divide and Conquer
b) Greedy
c) Backtracking
d) Branch

Answer: a
Clarification: Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems. It allows an algorithm called divide and conquer.

2. For how many vertices in a set, is top tree defined for underlying tree?
a) 3
b) 4
c) 5
d) 2

Answer: d
Clarification: Top tree is defined for a set having a maximum of 2 vertices for its underlying tree. Those sets having at maximum 2 vertices is called External Boundary Vertices.

3. How many edges are present in path cluster?
a) 2
b) 3
c) 6
d) 1

Answer: a
Clarification: There are at least 2 edges present in path cluster. Cluster in data structure is defined as the subtree that is connect having maximum of 2 vertices known as Boundary Vertices.

4. How many edges does a leaf cluster contain?
a) 0
b) 1
c) 2
d) 3

Answer: a
Clarification: If a cluster has no edges and contains only one vertex known as boundary vertex then, it is known as leaf cluster. So a leaf cluster doesn’t contain any edges. It is also known as Point cluster.

5. How many edges are present in Edge cluster?
a) 0
b) 1
c) 2
d) 4

Answer: b
Clarification: A cluster containing only single edge is known as Edge cluster. So there are in total 1 edge present in edge cluster. Cluster in data structure is defined as the subtree that is connect having maximum of 2 vertices known as Boundary Vertices.

6. 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: a
Clarification: Top tree data structure is used to maintain a dynamic forest using link or cut operations. Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems.

7. If A ꓵ B (A and B are two clusters) is a singleton set then it is a Merge able cluster.
a) True
b) False

Answer: a
Clarification: If A ꓵ B is a singleton set where A and B are two clusters, that is there are only one node that is common between the clusters then they are known as Merge able cluster.

8. Is Top tree used for maintaining Dynamic set of trees called forest.
a) True
b) False

Answer: a
Clarification: Top tree data structure is used to maintain a dynamic forest using link or cut operations. Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems.

9. 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: a
Clarification: Generally, trees have weight on its edges. Also there is one to one correspondence of the edges with the top trees. Therefore, top trees can be initialized in O (n) time.

10. How many top trees are there in a tree with single vertex?
a) 0
b) 1
c) 2
d) 3

Answer: a
Clarification: Tree having a single vertex has no clusters of tree present in the structure. Therefore, there are empty top trees in a tree having a single vertex. Trees with one node are single node.

11. Which property makes top tree a binary tree?
a) Nodes as Cluster
b) Leaves as Edges
c) Root is Tree Itself
d) All of the mentioned

Answer: d
Clarification: Top tree can be considered as a binary tree if the nodes form a cluster, leaves act as an edge and the root of the top tree acts as a tree itself. Then the top tree is called binary tree.

12. Which of the dynamic operations are used in Top Tree data structure implementation?
a) Link
b) Cut
c) Expose
d) All of the mentioned

Answer: d
Clarification: Link returns a single tree having different vertices from top trees. Cut removes the edge from the top tree. Expose is used to implement queries on top trees. Hence all of the options are used as dynamic operations.

13. Which of the following are used as an internal operation in Top tree?
a) Merge
b) Cut
c) Expose
d) Link

Answer: a
Clarification: Link returns a single tree having different vertices from top trees. Cut removes the edge from the top tree. Expose is used to implement queries on top trees. While merge is an internal operation used to merge two clusters and return as a parent cluster.

14. 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: c
Clarification: A lot of applications have been implemented using Top tree interface. Maintaining a dynamic set of weighted trees is one such application which can be implemented with O (log n) time complexity.

Leave a Reply

Your email address will not be published. Required fields are marked *