Q. How many leaf nodes can a full binary tree with n internal nodes have?
-
A.
n + 1
-
B.
n
-
C.
2n
-
D.
n/2
Solution
A full binary tree with n internal nodes has n + 1 leaf nodes.
Correct Answer:
A
— n + 1
Learn More →
Q. In a binary tree, how many leaf nodes can there be at maximum if there are n internal nodes?
-
A.
n + 1
-
B.
n
-
C.
2n
-
D.
n - 1
Solution
In a binary tree, the maximum number of leaf nodes is n + 1, where n is the number of internal nodes.
Correct Answer:
A
— n + 1
Learn More →
Q. In a binary tree, what is the in-order traversal of the nodes?
-
A.
Visit left subtree, root, right subtree
-
B.
Visit root, left subtree, right subtree
-
C.
Visit left subtree, right subtree, root
-
D.
Visit right subtree, root, left subtree
Solution
In in-order traversal, the nodes are visited in the order: left subtree, root, right subtree.
Correct Answer:
A
— Visit left subtree, root, right subtree
Learn More →
Q. What is the level-order traversal of a binary tree?
-
A.
Visit nodes from top to bottom, left to right
-
B.
Visit nodes from bottom to top, right to left
-
C.
Visit nodes in in-order
-
D.
Visit nodes in pre-order
Solution
Level-order traversal visits nodes from top to bottom and left to right.
Correct Answer:
A
— Visit nodes from top to bottom, left to right
Learn More →
Q. What is the post-order traversal of a binary tree with nodes 1, 2, and 3 where 1 is the root, 2 is the left child, and 3 is the right child?
-
A.
1, 2, 3
-
B.
2, 3, 1
-
C.
3, 2, 1
-
D.
1, 3, 2
Solution
In post-order traversal, the left child is visited first, then the right child, and finally the root, resulting in 2, 3, 1.
Correct Answer:
B
— 2, 3, 1
Learn More →
Q. What is the primary use of a binary tree in applications?
-
A.
Sorting data
-
B.
Storing hierarchical data
-
C.
Searching for data
-
D.
All of the above
Solution
Binary trees are used for sorting, storing hierarchical data, and searching for data, making option 'All of the above' correct.
Correct Answer:
D
— All of the above
Learn More →
Q. Which of the following is NOT a property of a binary tree?
-
A.
Each node has at most two children
-
B.
The left child is always less than the parent
-
C.
The right child is always greater than the parent
-
D.
It can be empty
Solution
The property that the left child is always less than the parent is specific to binary search trees, not all binary trees.
Correct Answer:
B
— The left child is always less than the parent
Learn More →
Q. Which traversal method is used to create a mirror image of a binary tree?
-
A.
In-order
-
B.
Post-order
-
C.
Pre-order
-
D.
Level-order
Solution
Pre-order traversal is used to create a mirror image of a binary tree by swapping left and right children.
Correct Answer:
C
— Pre-order
Learn More →
Showing 1 to 8 of 8 (1 Pages)