Tree_Quiz_Updated.pdf
Document Details
Uploaded by SereneCalcium
St. Paul University Quezon City
Tags
Related
Full Transcript
Quiz on Trees 1. What is a tree in data structures? a) A structure with a linear organization of data b) A data structure consisting of nodes connected by edges c) A set of unconnected nodes Answer: b) A data structure consisting of nodes connected b...
Quiz on Trees 1. What is a tree in data structures? a) A structure with a linear organization of data b) A data structure consisting of nodes connected by edges c) A set of unconnected nodes Answer: b) A data structure consisting of nodes connected by edges 2. Which of the following is the topmost node of a tree? a) Leaf b) Node c) Root Answer: c) Root 3. Which term refers to a node with no children? a) Edge b) Leaf c) Root Answer: b) Leaf 4. In which traversal method is the root node visited first? a) In-order traversal b) Pre-order traversal c) Post-order traversal Answer: b) Pre-order traversal 5. What is a Binary Search Tree (BST)? a) A tree where each node has at most two children b) A binary tree where the left child is less than the parent and the right child is greater c) A tree where nodes can have more than two children Answer: b) A binary tree where the left child is less than the parent and the right child is greater 6. Which of the following tree types is self-balancing? a) Binary Search Tree b) AVL Tree c) Heap Tree Answer: b) AVL Tree 7. What is the main characteristic of a Max-Heap? a) The value of each node is less than its children b) The value of each node is greater than or equal to its children c) The tree contains cycles Answer: b) The value of each node is greater than or equal to its children 8. What is the main use of a Trie data structure? a) Storing numerical values b) Storing strings and supporting prefix matching c) Sorting binary trees Answer: b) Storing strings and supporting prefix matching 9. What is the process of visiting all the nodes in a tree called? a) Searching b) Traversal c) Insertion Answer: b) Traversal 10. Which of the following is an advantage of using trees? a) Linear organization of data b) Efficient searching and retrieval c) Always simpler than other data structures Answer: b) Efficient searching and retrieval 11. Which tree traversal method produces sorted key values when applied to a binary search tree (BST)? a) Pre-order traversal b) In-order traversal c) Post-order traversal Answer: b) In-order traversal 12. Which of the following tree structures is commonly used in databases and file systems? a) Binary Tree b) B-Tree c) Trie Answer: b) B-Tree 13. In a Binary Search Tree (BST), which child is always greater than the parent node? a) Left child b) Right child c) Any child Answer: b) Right child 14. Which of the following trees does not allow duplicate elements? a) AVL Tree b) Binary Search Tree (BST) c) Both Answer: c) Both 15. What is the maximum number of children a node can have in a binary tree? a) 1 b) 2 c) 3 Answer: b) 2 16. Which tree is known for its efficient operations when working with dynamic sets of data where frequent insertions and deletions occur? a) Binary Tree b) AVL Tree c) B-Tree Answer: c) B-Tree 17. What is the balance factor of a node in an AVL tree? a) The number of children the node has b) The difference in height between the left and right subtrees c) The depth of the node in the tree Answer: b) The difference in height between the left and right subtrees 18. Which of the following tree traversal methods visits the root node last? a) Pre-order traversal b) Post-order traversal c) In-order traversal Answer: b) Post-order traversal 19. Which tree is commonly used for implementing priority queues? a) Heap Tree b) Binary Search Tree c) B-Tree Answer: a) Heap Tree 20. In a Trie data structure, what does each node represent? a) A string b) A character c) A subtree Answer: b) A character