Name: Class: Date: CSCI-401 Examlet #5 True/False Indicate whether the sentence or statement is true or false. 1. The root node of the standard binary tree can be drawn anywhere in the tree diagram. 2. Each node in a binary tree contains data and a link to the left child and a link to the right child. 3. Any node in a binary tree can be called a leaf node. 4. The level of a node in a binary tree is the number of branches on the path from the root to the node. 5. The level of the root node of a binary tree is 1, and the level of the children of the root node is 0. 6. The height of a binary tree is the number of nodes on the longest path from the root to a leaf. 7. In an inorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. 8. In an preorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. 9. In an postorder traversal, the binary tree is traversed as follows: 1)Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. 10. The listing of the nodes produced by the inorder traversal of a binary tree is called the preorder sequence. 11. In a binary search tree the key in the root node is larger than every key in the left subtree and smaller than every key in the right subtree. 12. When deleting a node from a binary search tree you must consider three cases. 13. Recursive functions are more efficient then their iterative versions. 14. A perfectly balanced binary tree is a binary tree such that: 1) the height of the left and right subtrees of the root are equal, and 2) the left and right subtrees of the root are perfectly balanced binary trees. Multiple Choice Identify the letter of the choice that best completes the statement or answers the question. 15. If a binary tree x has two subtrees, left and right, which of the following must be true about left and right? a. left and right are binary trees c. left and right are linked lists b. left and right are lists d. left and right are queues 1
Name: 16. In the figure above we see a. a. binary tree with six nodes c. binary tree with seven nodes b. binary tree with four branches d. binary tree with eight branches 17. In the figure above, the root node contains. a. 20 c. 60 b. 28 d. 88 18. In the figure above, the leftmost node contains. a. 20 c. 70 b. 28 d. 88 19. In the figure above, the rightmost node contains. a. 28 c. 88 b. 60 d. 90 20. There is a unique path from the to every node in the binary tree. a. branch c. reference b. root d. info 21. The of a node in a binary tree is the number of branches on the path from the root to the node. a. level c. width b. height d. depth 22. The of a binary tree is the number of nodes on the longest path from the root to a leaf. a. level c. width b. height d. depth 2
Name: 23. In the figure above, the inorder sequence is. a. A B D C c. B D A C b. D B C A d. B D C A 24. In the figure above, the preorder sequence is. a. B D A C c. D B C A b. A B D C d. D B A C 25. In the figure above, the postorder sequence is. a. B D A C c. D B C A b. A B D C d. D B A C 26. Which of the following is not an operation performed on a binary tree? a. search the tree c. delete an item from the tree b. move the tree d. copy the tree 27. In a binary search tree, the key in the node is larger than every key in the left subtree and smaller than every key in the right subtree. a. child c. right b. root d. head 28. There are cases to consider when deleting a node from a binary search tree. a. two c. four b. three d. five 29. With respect to binary trees, the recursive tree traversal functions are than their iterative versions. a. equally efficient c. less efficient b. more efficient d. more complex 30. In a perfectly balanced binary tree. a. the height of the left and right subtrees of the root are equal b. the height of the left and right subtrees of the root differ by 1 c. the height of the left and right subtrees of the root is 1 d. b or c only 31. In a perfectly balanced binary tree. a. the left and right subtrees of the root are binary trees b. the left and right subtrees of the root have the same depth c. the left and right subtrees of the root have the same width d. the left and right subtrees of the root are perfectly balanced binary trees 3
Name: 32. What is the level of the children of the root node of a binary tree? a. -1 c. 1 b. 0 d. 2 33. The inorder traversal of the tree above is. a. 46-30-58-50-77-80-70-60 c. 30-46-50-58-60-70-77-80 b. 80-77-70-60-58-50-46-30 d. 60-50-30-46-58-70-80-77 34. The postorder traversal of the tree above is. a. 46-30-58-50-77-80-70-60 c. 30-46-50-58-60-70-77-80 b. 80-77-70-60-58-50-46-30 d. 60-50-30-46-58-70-80-77 35. The preorder traversal of the tree above is. a. 46-30-58-50-77-80-70-60 c. 30-46-50-58-60-70-77-80 b. 80-77-70-60-58-50-46-30 d. 60-50-30-46-58-70-80-77 4
CSCI-401 Examlet #5 Answer Section TRUE/FALSE 1. ANS: F REF: 594 2. ANS: T REF: 598 3. ANS: F REF: 599 4. ANS: T REF: 599 5. ANS: F REF: 599 6. ANS: T REF: 599 7. ANS: T REF: 601 8. ANS: F REF: 602 9. ANS: F REF: 602 10. ANS: F REF: 602 11. ANS: T REF: 613 12. ANS: F REF: 618 13. ANS: F REF: 626 14. ANS: T REF: 630 MULTIPLE CHOICE 15. ANS: A REF: 594 16. ANS: C REF: 597 17. ANS: C REF: 597 18. ANS: B REF: 597 19. ANS: C REF: 597 20. ANS: B REF: 599 21. ANS: A REF: 599 22. ANS: B REF: 599 23. ANS: C REF: 604 24. ANS: B REF: 604 25. ANS: C REF: 604 26. ANS: B REF: 605 27. ANS: A REF: 613 28. ANS: A REF: 618 29. ANS: B REF: 626 30. ANS: A REF: 630 31. ANS: D REF: 630 32. ANS: C REF: 599 33. ANS: C REF: 601 34. ANS: A REF: 602 35. ANS: D REF: 602 1
CSCI-401 Examlet #5 [Answer Strip] C 32. F 1. T 2. F 3. T 4. F 5. T 6. T 7. C 23. F 8. C 16. B 24. F 9. C 17. C 25. F 10. T 11. B 18. B 26. C 33. F 12. F 13. C 19. A 27. A 34. T 14. B 20. A 28. D 35. A 21. B 29. A 15. B 22. A 30. D 31.