Finals Reviewer ITC04 Data Structures & Algorithms PDF
Document Details
Uploaded by Deleted User
Universidad de Dagupan
2024
UNIVERSIDAD DE DAGUPAN
Arnaldy D. Fortin, MBA, MCS
Tags
Summary
This document is a reviewer for the Finals of the ITC04 Data Structures & Algorithms subject at the University of Dagupan, 2024-2025. It contains multiple-choice questions covering topics like binary trees, expression trees, tree traversals, and related concepts.
Full Transcript
![](media/image2.png) **PART I: MULTIPLE CHOICES: Choose from among the choices the answer that best fits the requirement. Write your answers in [UPPERCASE format.]** 1. Which traversal method is most suitable for reconstructing a binary tree when combined with in-order traversal? A. **...
![](media/image2.png) **PART I: MULTIPLE CHOICES: Choose from among the choices the answer that best fits the requirement. Write your answers in [UPPERCASE format.]** 1. Which traversal method is most suitable for reconstructing a binary tree when combined with in-order traversal? A. **Pre-order** B. Post-order C. Level-order D. Any traversal 2. In an expression tree, what does each leaf node typically represent? E. An operator F. **A variable or constant** G. A mathematical function H. A group of sub-expressions 3. Which of the following is true about an operator node in an expression tree? I. It holds a variable J. **It performs a computation on two child nodes** K. It does not have children L. It only stores numeric values 4. What is typically stored in the internal (non-leaf) nodes of an expression tree? M. Constants N. Variables O. **Operators** P. Parentheses 5. Which of the following is an example of an expression tree for the expression (3+2)×5? Q. **The root is ×, with children + and 5.** R. The root is +, with children 3 and 2. S. The root is +, with children × and 5. T. The root is ×, with children 3 and 2. 6. What type of binary tree is structured to maintain a sorted order? U. Full Binary Tree V. AVL Tree W. **Binary Search Tree (BST)** X. Complete Binary Tree 7. Which binary tree ensures the left and right subtrees of any node differ in height by at most 1? Y. Red-Black Tree Z. Complete Binary Tree A. **AVL Tree** B. Perfect Binary Tree 8. In a complete binary tree, all levels except possibly the last are\... C. Completely empty D. Filled arbitrarily E. **Completely filled from left to right** F. In reverse order 9. What is a full binary tree? G. A binary tree where each level has exactly one node H. A binary tree with at least one child per node I. A binary tree where the root has no children J. **A binary tree where every node has 0 or 2 children** 10. What type of binary tree is used to implement heaps? K. Full Binary Tree L. AVL Tree M. **Complete Binary Tree** N. Red-Black Tree 11. Which type of binary tree is also known as a balanced binary search tree? O. Complete Binary Tree P. Full Binary Tree Q. **AVL Tree** R. Heap 12. What type of binary tree has all leaf nodes at the same level? S. AVL Tree T. Red-Black Tree U. **Perfect Binary Tree** V. Full Binary Tree 13. What type of binary tree is commonly used in memory management? W. Binary Search Tree X. **Binary Heap** Y. Complete Binary Tree Z. Perfect Binary Tree 14. Which binary tree balances itself after insertion or deletion of nodes? A. Complete Binary Tree B. **AVL Tree** C. Full Binary Tree D. Heap 15. What is the property of a Red-Black Tree? E. Every node has exactly two children. F. **Nodes are either red or black.** G. All levels except the last are filled left to right. H. Nodes can only be black. 16. What is the term for a node that has no children? I. Parent node J. **Leaf node** K. Root node L. Sibling node 17. Which traversal method visits nodes in the order: root, left subtree, right subtree? M. Level-order N. In-order O. **Pre-order** P. Post-order 18. What is the maximum number of children a node in a binary tree can have? Q. Unlimited R. 1 S. **2** T. 3 19. Which of the following is true about a binary search tree (BST)? U. There are no specific rules for node placement. V. All left subtree values are greater than the root. W. All right subtree values are smaller than the root. X. **Left subtree values are smaller, and right subtree values are greater than the root.** 20. What is a binary tree? Y. A tree with only leaf nodes Z. A tree with no root A. **A tree with at most two children per node** B. A tree with at least three children per node 21. In a binary tree, if a node has one child, which of the following is true? C. It is the root node. D. It is a leaf node. E. It has exactly two children. F. **It can have either a left or right child, but not both.** 22. What is the typical behavior when inserting a node into a binary tree that already has two children? G. The tree is reorganized to fit the new node. H. The node is not inserted. I. **It looks for the next available position using level-order traversal.** J. The node replaces one of the children. 23. How is a node created in a binary tree? K. By setting it as the root of the tree. L. By adding it to an array. M. By traversing the tree. N. **By initializing it with a value and setting its left and right pointers to null.** 24. What is true about inserting a new node in a binary tree? O. The new node is placed only in the left subtree. P. The tree must always remain complete after insertion. Q. The insertion position is determined arbitrarily. R. **The new node is always a leaf node.** 25. What is tree traversal? S. Deleting nodes from a tree T. Balancing a tree U. Rearranging the nodes of a tree V. **Visiting all the nodes of a tree in a specific order** 26. Which traversal method visits the root node before its subtrees? W. Post-order X. In-order Y. **Pre-order** Z. Level-order 27. In which traversal is the root visited last? A. Level-order B. In-order C. Pre-order D. **Post-order** 28. Which traversal visits the left subtree, then the root, and finally the right subtree? E. Pre-order F. **In-order** G. Post-order H. Level-order 29. What is the order of nodes visited in pre-order traversal? I. Right subtree, root, left subtree J. Left subtree, root, right subtree K. **Root, left subtree, right subtree** L. Root, right subtree, left subtree 30. Which traversal is also known as depth-first search (DFS)? M. **Pre-order** N. Level-order O. In-order P. Post-order 31. Which data structure is typically used for iterative tree traversal? Q. Linked list R. Queue S. **Stack** T. Array 32. In post-order traversal, which part of the tree is visited first? U. Right subtree V. Any subtree W. Root X. **Left subtree** 33. Which traversal method processes nodes level by level? Y. Pre-order Z. Post-order A. In-order B. **Level-order** 34. What is the order of nodes visited in in-order traversal for a binary search tree? C. **Ascending order** D. Descending order E. Random order F. None of the above 35. What type of traversal is used to evaluate expressions in an expression tree? G. In-order H. Pre-order I. **Post-order** J. Level-order 36. Which type of binary tree is used in Huffman encoding? K. Binary Search Tree L. Complete Binary Tree M. AVL Tree N. **Full Binary Tree** 37. What is the key property of a Binary Search Tree (BST)? O. All levels are completely filled. P. Each node has exactly two children. Q. **Left child values are smaller, and right child values are larger than the root.** R. Nodes can only have integer values. 38. What happens when you insert a value into a BST that is smaller than the root? S. It is placed in the right subtree. T. It replaces the root. U. It is not allowed. V. **It is placed in the left subtree.** 39. Where is a value placed if it is greater than the root in a BST? W. At the root X. In the left subtree Y. **In the right subtree** Z. It is ignored. 40. Which traversal order can be used to check if a BST is correctly sorted? A. **In-order** B. Pre-order C. Post-order D. Level-order **PREPARED BY:** **[ARNALDY D. FORTIN, MBA, MCS]** **SITE, FACULTY**