1. What is a tree in data structures?
(A) A non-linear data structure
(B) A linear data structure
(C) A type of array
(D) A fixed-size data structure
2. What is the maximum number of children a binary tree node can have?
(A) One
(B) Unlimited
(C) Three
(D) Two
3. What is the height of a tree?
(A) The number of edges from the root to the farthest leaf
(B) The number of nodes
(C) The total number of levels
(D) The number of leaf nodes
4. In a binary tree, what is the maximum number of nodes at level n?
(A) n
(B) 2^n
(C) 2^(n-1)
(D) n^2
5. What is a full binary tree?
(A) A tree with all levels fully filled
(B) A tree where every node has either 0 or 2 children
(C) A tree with a single path from root to leaf
(D) A tree with at least one leaf node
6. What is a complete binary tree?
(A) A tree where all levels are fully filled except possibly the last
(B) A tree where all nodes have two children
(C) A tree with no leaf nodes
(D) A binary tree with only one path
7. What is the purpose of a binary search tree (BST)?
(A) All of the above
(B) To allow efficient searching, insertion, and deletion
(C) To keep elements sorted
(D) To store data in a non-linear format
8. What is the in-order traversal of a binary tree?
(A) Visit the left subtree, then root, then right subtree
(B) Visit the root, then left subtree, then right subtree
(C) Visit the right subtree, then root, then left subtree
(D) Visit nodes in level order
9. What is the pre-order traversal of a binary tree?
(A) Visit the left subtree, then root, then right subtree
(B) Visit nodes in level order
(C) Visit the right subtree, then root, then left subtree
(D) Visit the root, then left subtree, then right subtree
10. What is the post-order traversal of a binary tree?
(A) Visit the left subtree, then root, then right subtree
(B) Visit the root, then left subtree, then right subtree
(C) Visit the left subtree, then right subtree, then root
(D) Visit nodes in level order
11. What is the worst-case time complexity for searching in a binary search tree?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
12. Which of the following is NOT a property of a binary search tree?
(A) Left subtree nodes are less than the root
(B) All nodes must have two children
(C) Right subtree nodes are greater than the root
(D) Each subtree must also be a binary search tree
13. What is the minimum height of a binary tree with n nodes?
(A) log(n)
(B) n
(C) n – 1
(D) log(n + 1)
14. What is a balanced binary tree?
(A) A tree where all leaf nodes are at the same level
(B) A tree where every node has two children
(C) A tree that is complete
(D) A tree where the height difference between left and right subtrees is no more than one
15. What is a binary heap?
(A) A type of binary search tree
(B) A complete binary tree that satisfies the heap property
(C) A linear data structure
(D) A tree with random node arrangement
16. What is the space complexity for storing a binary tree?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n log n)
17. Which traversal method is used to sort a binary search tree?
(A) In-order traversal
(B) Pre-order traversal
(C) Post-order traversal
(D) Level-order traversal
18. What is the level of a node in a tree?
(A) The total number of nodes
(B) The height of the node
(C) The number of edges from the root to the node
(D) The depth of the node
19. What is a leaf node in a tree?
(A) A node that is the root
(B) A node with one child
(C) A node with two children
(D) A node with no children
20. Which data structure can be used to implement a tree?
(A) Array
(B) Linked list
(C) Both A and B
(D) None of the above
21. What is the breadth-first search (BFS) traversal of a tree?
(A) Level-order traversal
(B) Pre-order traversal
(C) In-order traversal
(D) Post-order traversal
22. What is a binary tree with all nodes having 0 or 1 child called?
(A) Complete binary tree
(B) Full binary tree
(C) Degenerate tree
(D) Balanced binary tree
23. What is the depth of a node in a tree?
(A) The number of nodes from the root to the node
(B) The height of the tree
(C) The number of edges from the root to the node
(D) The level of the tree
24. What is a B-tree?
(A) A self-balancing tree that maintains sorted data
(B) A binary search tree
(C) A complete binary tree
(D) A type of heap
25. What is the height of a balanced binary tree with n nodes?
(A) n/2
(B) n
(C) log(n)
(D) log(n + 1)
26. What is a Red-Black tree?
(A) A type of binary search tree
(B) A binary heap
(C) A self-balancing binary search tree
(D) A complete binary tree
27. What is the main advantage of using a self-balancing tree?
(A) It maintains a balanced structure for efficient operations
(B) It requires less memory
(C) It is easier to implement
(D) It allows for random access
28. What is a thread in a threaded binary tree?
(A) A pointer to a child node
(B) A pointer to the parent node
(C) A pointer to the next node in in-order traversal
(D) A pointer to the root node
29. What type of tree is used to implement a priority queue?
(A) Binary search tree
(B) AVL tree
(C) Red-Black tree
(D) Binary heap
30. What is the main characteristic of a ternary tree?
(A) Each node has up to two children
(B) Each node has up to three children
(C) It is a complete binary tree
(D) It is a degenerate tree
31. What type of traversal uses a stack?
(A) Breadth-first search
(B) Both B and C
(C) In-order traversal
(D) Depth-first search
32. What is the primary characteristic of a Splay tree?
(A) It is self-balancing
(B) It uses rotation to move frequently accessed nodes closer to the root
(C) All of the above
(D) It is a binary search tree
33. What is the function of the left and right pointers in a binary tree node?
(A) To point to the parent node
(B) To store data
(C) To point to the left and right children
(D) To store the height of the tree
34. In which scenario would you use a trie?
(A) To implement a priority queue
(B) For tree traversal
(C) For numerical data storage
(D) To store strings for fast retrieval
35. What is the main disadvantage of a linked representation of a binary tree?
(A) It is less efficient than an array
(B) It is harder to implement
(C) It consumes more memory due to pointers
(D) All of the above
36. What is the relationship between the height and number of nodes in a complete binary tree?
(A) Height = n – 1
(B) Height = n
(C) Height = n/2
(D) Height = log(n)
37. What does the term “height balanced” refer to in trees?
(A) The difference in heights between left and right subtrees is minimal
(B) The height is the same for all nodes
(C) All levels are completely filled
(D) The total number of nodes is minimal
38. Which tree structure allows for fast lookup, insertion, and deletion operations?
(A) Linked list
(B) Array
(C) Binary search tree
(D) Stack
Basic Concepts
Non-Linear Data Structures MCQs
Sorting and Searching Algorithms MCQs
- Data Structures MCQs 1
- Data Structures MCQs 2
- Data Structures MCQs 3
- Data Structures MCQs 4
- Data Structures MCQs 5
- Stacks Solved MCQs
- Queues MCQs
- pointer mcqs
- Array MCQs