Explore topic-wise InterviewSolutions in .

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

101.

What is the Height of the given ternary tree?(a) 0(b) 1(c) 2(d) 3The query is from Ternary tree in division Trees of Data Structures & Algorithms II have been asked this question during an online interview.

Answer»

The correct OPTION is (c) 2

Best explanation: HEIGHT of the tree is defined as the length of the PATH from root node to the DEEPEST node of the tree. Here deepest nodes are 5,6,7 which are at length 2. So the height of the ternary tree is 2.

102.

What is the depth of Node G in the given ternary tree?(a) 0(b) 1(c) 2(d) 3The origin of the question is Ternary tree topic in chapter Trees of Data Structures & Algorithms II got this question in quiz.

Answer»

Correct option is (C) 2

Best explanation: Depth of the node is the LENGTH of the PATH from root to the node. Here, length of path from root to Node G is 2. So depth of Node G is 2.

103.

Which node is the child node of the Node D in the following ternary tree?(a) A(b) C(c) B(d) No child nodeI would like to ask this question from 1 in division Trees of Data Structures & Algorithms IThe question was posed to me in an interview for job.

Answer» CORRECT answer is (d) No CHILD node

For EXPLANATION: SINCE Node D is the Leaf node of the above ternary tree and leaf node has no child node. So there is no child node for Node D in the above ternary tree.
104.

Which node is the child node of Node D in the following ternary tree?(a) A(b) C(c) G(d) HMy enquiry is from 1 topic in portion Trees of Data Structures & Algorithms II have been asked this question in an online quiz.

Answer» CORRECT OPTION is (d) H

The EXPLANATION is: The CHILD node is the node that has a directed path from its parent node. Since Node D has a direct path to Node H, So Node H is the Child node.
105.

Is parent node of Node 3 and root node of the given ternary tree same?(a) True(b) FalseThe origin of the question is 1 topic in chapter Trees of Data Structures & Algorithms IThe question was asked in an online interview.

Answer»

The correct ANSWER is (a) True

The explanation is: Since ROOT NODE of the TERNARY tree is Node 1 and ALSO Node 1 has three children that is Node 2, Node 3, Node 4. So parent node of Node 3 and the root node of the ternary tree are same.

106.

Which node is the parent node of Node 6?(a) 1(b) 5(c) 2(d) 3My question comes from 1 in section Trees of Data Structures & Algorithms IThis question was addressed to me during an interview.

Answer»

The correct option is (c) 2

Easiest EXPLANATION - Since Node 2 has TWO children Node 5 and Node 6, So Node 2 is the parent node of Node 6. While Node 1 is ROOT node and Node 3 and Node 5 are Leaf node.

107.

Which node is the Leaf node in the following ternary tree?(a) A(b) B(c) D(d) GMy enquiry is from 1 in portion Trees of Data Structures & Algorithms IThis question was addressed to me in an interview.

Answer»

The correct ANSWER is (d) G

The best I can explain: Leaf node is any node that does not contain any CHILDREN. Since Node G is the node without any children, So G is CALLED Leaf Node. While Node A is root node and Node B, Node C, Node D is PARENT node of their children.

108.

Which node is the root node of the following ternary tree?(a) A(b) B(c) C(d) DQuery is from 1 topic in portion Trees of Data Structures & Algorithms II have been asked this question in an interview.

Answer»

Correct choice is (a) A

To explain: Node A is CALLED the root node of the above ternary TREE while the Node B, Node C, Node D are called LEAF node.

109.

What is the Height of the root node of ternary tree?(a) 1(b) 2(c) 3(d) 0My question is from 1 topic in portion Trees of Data Structures & Algorithms IThe question was asked during an internship interview.

Answer»

Right CHOICE is (d) 0

The best EXPLANATION: Height of TERNARY tree is defined as the length of path from ROOT to deepest node in tree. Therefore, height off root node in ternary tree is 0.

110.

What is the depth of the root node of the ternary tree?(a) 2(b) 1(c) 0(d) 3I'm obligated to ask this question of 1 topic in section Trees of Data Structures & Algorithms IThe question was asked in unit test.

Answer»

The correct answer is (c) 0

Easiest EXPLANATION - DEPTH is defined as the LENGTH of the path from ROOT to the node. So the depth of root node in ternary tree is 0.

111.

Which of the following is the name of the node having child nodes?(a) Brother(b) Sister(c) Mother(d) ParentThis interesting question is from 1 topic in portion Trees of Data Structures & Algorithms II have been asked this question in quiz.

Answer»

Correct choice is (d) Parent

The best I can explain: Parent node is the node having CHILD nodes and child nodes MAY contain references to their PARENTS. Parent node is a node CONNECTED by a directed edge to its child.

112.

How many child nodes does each node of Ternary Tree contain?(a) 4(b) 6(c) 5(d) 3The above asked question is from 1 topic in portion Trees of Data Structures & Algorithms II have been asked this question during an interview.

Answer»

Correct choice is (d) 3

The best I can explain: Each NODE of Ternary tree contains at most 3 nodes. So Ternary tree can have 1, 2 or 3 CHILD nodes but not more than that.