DSA Answer Key
DSA Answer Key
a) Root
b) Leaf
c) Edge
d) Vertex
2. What is the root node of a tree?
a) A node with no children.
b) The topmost node of a tree.
c) A node with two children.
d) A node with one parent.
3. Which of the following is a type of tree traversal?
a) Level-order
b) Depth-order
c) Height-order
d) Node-order
4. What data structure is commonly used for implementing a breadth-first traversal?
a) Stack
b) Queue
c) Array
d) Linked list
5. Which traversal method visits the nodes of a tree in the order: Root, Left, Right?
a) Inorder
b) Preorder
c) Postorder
d) Level-order
6. In which traversal method are the nodes visited in the following order: Left, Right, Root?
a) Preorder
b) Inorder
c) Postorder
d) Level-order
7. What type of tree traversal is commonly used to evaluate arithmetic expressions?
a) Inorder
b) Preorder
c) Postorder
d) Level-order
8. Which data structure is typically used for implementing depth-first traversal of a tree?
a) Stack
b) Queue
c) Array
d) Hash Table
9. True or False: In an inorder traversal of a binary search tree, the nodes are visited in ascending
order.
10. True or False: A tree traversal where nodes are visited level by level is called depth-first traversal.
11. True or False: In a postorder traversal, the root node is visited last.
12. True or False: A stack is used for implementing breadth-first traversal of a tree.
13. True or False: Tree traversal can be used to search for a specific node in a tree.
14. True or False: In a preorder traversal, the left subtree is always visited before the right subtree.
15. The process of visiting all the nodes in a tree is called traversal.
16. A tree traversal method where nodes are visited one level at a time from top to bottom is called
level-order traversal.
17. A tree traversal that uses a stack data structure is called depth-first traversal.
18. The node at the top of a tree is called the root.
19. In a postorder traversal, the root node is visited last.
20. The data structure commonly used for implementing level-order traversal is a queue.