K-ary Tree Multiple Choice Questions and Answers (MCQs) – 2

«
»

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

1. What is the size of the given K-ary tree?
The size of the given K-ary tree is 6 in the given diagram
a) 3
b) 2
c) 6
d) 4
View Answer

Answer: c
Explanation: Size of the K-ary tree is defined as the total number of nodes present in the tree. Since there are total of 6 nodes in the K-ary tree. So the size of the K-ary tree is 6.
advertisement

2. Who is the ancestor of Node H?
The ancestor of Node H is D between node H & root
a) D
b) F
c) H
d) A
View Answer

Answer: a
Explanation: Ancestor node is a node that comes in between the path from the node to the root. Since Node D comes between node H and root, so Node D is called the ancestor node.

3. Who is descendant of Node C?
The ancestor of Node H is D between node H & root
a) A
b) E
c) D
d) G
View Answer

Answer: d
Explanation: Descendant node is a node which has a direct path from ancestor node. Since Node G is connected to C, so Node G is the descendant of Node C.
Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
advertisement

4. What is the size of Node B in given K-ary tree?
Find the size of Node B in given K-ary tree
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: a
Explanation: Size of node is defined as the total number of descendants of that node including itself. So, size of Node B is 1.

5. Can leaf node be called child node in a K-ary tree?
a) True
b) false
View Answer

Answer: a
Explanation: Leaf node is a node that has no child. Since Leaf node will always be the node on the last level of k-ary tree, so it can be called child node of given parent node in K-ary tree.
Take Data Structure I Practice Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
advertisement

6. Can child node be always called Leaf node in the K-ary tree?
a) True
b) False
View Answer

Answer: b
Explanation: Leaf node is any node that does not contain any children. Child node may or may not contain more nodes. Child node will only be called leaf Node if the node has no child node.

7. 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
View Answer

Answer: b
Explanation: In the K-ary tree having height h, the upper bound for having maximum number of leaves is k^h.
advertisement

8. What is the height of a K-ary tree having only root node?
a) 1
b) 0
c) 2
d) 3
View Answer

Answer: b
Explanation: Height of a K-ary tree does not include the root node. So the height of the K-ary tree is without root node is 0.

9. 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
View Answer

Answer: a
Explanation: The parent node for the node of index I in a K-ary tree is given by (I-1)/K.
advertisement

10. Which nodes are the siblings of Node D of given ternary tree?
The ancestor of Node H is D between node H & root
a) E
b) C
c) F
d) H
View Answer

Answer: d
Explanation: Siblings are the nodes that share same parent. Since both the Node H is parent Node D, So the sibling of Node D is Node H.

11. 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
View Answer

Answer: d
Explanation: Every Full K-ary tree is also a complete K-ary tree. Therefore, both have same number of nodes.

12. Is Node A sibling of Node B in the given K-ary tree?
Find the size of Node B in given K-ary tree
a) True
b) False
View Answer

Answer: b
Explanation: Node D, Node C are the siblings of Node B while Node A is the parent node of Node B.

Sanfoundry Global Education & Learning Series – Data Structure.

To practice all areas of Data Structure, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.