This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “K-ary Tree

**1. Which node is the Leaf node in the following K-ary tree?**

A) A

B) B

C) D**D) F**

Explanation: Any node that does not have any children is referred to as a leaf node. Since Node F has no children, it is referred to as a Leaf Node. If Node A is the root node, Node B, Node C, and Node D are their children’s parent nodes.

**2. Which node is the parent node of Node 5?**

A) 1

B) 5**C) 2**

D) 3

Explanation: Node 2 is the parent node of Node 5 because it has two children, Node 5 and Node 6. Node 1 is the root node, and Nodes 3 and 5 are the leaf nodes.

**3. Is parent node of Node 4 and root node of the given K-ary tree same?**

**A) True**

B) False

Explanation: Node 1 is the ternary tree’s root node, and Node 1 has three children: Node 2, Node 3, and Node 4. As a result, Node 4’s parent node and the ternary tree’s root node are the same.

**4. Which node is the child node of Node C in the following K-ary tree?**

A) A

B) C**C) G**

D) H

Explanation: The node with a guided path from its parent is called a child node. Node G is the child node since Node C has a direct path to it.

**5. Which node is the child node of the Node B in the following K-ary tree?**

A) A

B) C

C) B**D) No child node**

Explanation: Since Node B is the Leaf node in the ternary tree above, it has no children. As a result, in the K-ary tree above, Node B has no children.

**6. What is the depth of Node F in the given K-ary tree?**

A) 0

B) 1**C) 2**

D) 3

Explanation: The length of the path from the root to the node is the depth of the node. The length of the path from the root to Node F is 2 in this case. As a result, Node F has a depth of two.

**7. What is the Height of the given K-ary tree?**

A) 0

B) 1**C) 2**

D) 3

Explanation: The length of the path from the root node to the deepest node of the tree is referred to as the tree’s height. The deepest nodes are 5,6,7, and they are 2 in length. As a result, the K-ary tree stands at a height of 2.

**8. Which node is the root node of the following K-ary tree?**

**A) A**

B) B

C) C

D) D

Explanation: The root node of the above K-ary tree is Node A, while the leaf nodes are Node B, Node C, and Node D.

**9. How many child nodes does each node of K-ary Tree contain?**

A) 2

B) 3

C) more than k**D) at most k**

Explanation: Each node in a K-ary tree has a maximum of k nodes. A tree with two nodes is known as a Binary tree, and a tree with three nodes is known as a Ternary tree.

**10. Which of the following is the name of the node having child nodes?**

A) Brother

B) Sister

C) Mother**D) Parent**

Explanation: Child nodes may contain references to their parents, and parent nodes may contain references to their children. A parent node is a node that is connected to its child by a directed edge.

**11. What is the depth of the root node of K-ary tree?**

A) 2

B) 1**C) 0**

D) 3

Explanation: The length of the path from the root to the node is known as depth. As a result, the depth of the root node in the K-ary tree is 0.

**12. What is the Height of the root node of K-ary tree?**

A) 1

B) 2

C) 3**D) 0**

Explanation: The length of the path from the root to the deepest node in a K-ary tree is known as its height. As a result, the height of the root node in a K-ary tree is 0.

**13. Can child node be always called Leaf node in the K-ary tree?**

A) True**B) False**

Explanation: Any node that does not have any children is referred to as a leaf node. There may or may not be more nodes in a child node. If the node has no children, the child node is referred to as a leaf node.

**14. What is the upper bound for maximum leaves in K-ary tree with height h?**

A) K*h**B) K^h**

C) K+h

D) K-h

Explanation: The upper bound for having the maximum number of leaves in a K-ary tree with height h is kh.

**15. What is the height of a K-ary tree having only root node?**

A) 1**B) 0**

C) 2

D) 3

Explanation: The root node is not included in the height of a K-ary tree. As a result, the K-ary tree’s height without a root node is 0.

**16. Which one of the following is the correct formulae to find the parent node at index I?****A) (I-1)/K**

B) (I+1)/K

C) (I*1)/K

D) (I-2)/K

Explanation: In a K-ary tree, (I-1)/K is the parent node for the node with index I.

**17. Which nodes are the siblings of Node D of given ternary tree?**

A) E

B) C

C) F**D) H**

Explanation: Nodes with the same parent are referred to as siblings. Since Node H and Node D are both parents, Node H is Node D’s sibling.

**18. How many extra nodes are there in Full K-ary tree than complete K-ary tree?**

A) 1

B) 2

C) 3**D) Both have same number of nodes**

Explanation: Every complete K-ary tree is a full K-ary tree. As a result, they both have the same number of nodes.

**19. Is Node A sibling of Node B in the given K-ary tree?**

A) True**B) False**

Explanation: Node D and Node C are Node B’s relatives, while Node A is Node B’s parent node.

**20. What is the size of the given K-ary tree?**

A) 3

B) 2**C) 6**

D) 4

Explanation: The total number of nodes in the K-ary tree is known as the tree’s size. Since the K-ary tree has a total of 6 nodes. As a result, the K-ary tree is 6 feet tall.

**21. Who is the ancestor of Node H?**

**A) D**

B) F

C) H

D) A

Explanation: An ancestor node is a node that exists between the node and the root. Since Node D is located between Node H and the root, it is referred to as the ancestor node.

**22. Who is descendant of Node C?**

A) A

B) E

C) D**D) G**

Explanation: A descendant node is one that has a direct connection to the ancestor node. Node G is a descendant of Node C since it is related to it.

**23. What is the size of Node B in given K-ary tree?**

**A) 1**

B) 2

C) 3

D) 4

Explanation: The total number of descendants of a node, including itself, is defined as its size. As a result, Node B has a size of 1.

**24. Can leaf node be called child node in a K-ary tree?****A) True**

B) false

Explanation: A leaf node is a node that does not have any children. Since the leaf node is always the last node in a k-ary tree, it can be referred to as the child node of a given parent node.

Each node in a K-ary tree has a maximum of k nodes. A tree with two nodes is known as a Binary tree, and a tree with three nodes is known as a Ternary tree. A complete m-ary tree is one in which each node has either 0 or m children within each level. If the last level isn’t over, all of the tree’s nodes must be “as far left as possible.” A complete m-ary tree with all leaf nodes at the same depth is called a perfect m-ary tree.