How many children can a binary tree node have at most?
A One
B Three
C Two
D Unlimited
Answer: C. Two. A binary tree node has at most two children.
What is a tree's root?
A Topmost node
B Node with no children only
C Last inserted leaf
D Smallest key always
Answer: A. Topmost node. The root is the top node from which a tree is organized.
What is a leaf node?
A Node with two parents
B The root only
C Node with no children
D Node with no value
Answer: C. Node with no children. A leaf has no child nodes.
What does a node's degree count?
A Its ancestors
B Its children
C Its key bits
D Its sibling values
Answer: B. Its children. A node's degree is the number of its children.
What order does a binary search tree use?
A Keys stored by arrival only
B All left keys larger
C Heap ordered keys
D Left keys smaller, right larger
Answer: D. Left keys smaller, right larger. A binary search tree orders keys across its left and right subtrees.
Which traversal of a BST visits keys in sorted order?
A Preorder
B Inorder
C Postorder
D Level order
Answer: B. Inorder. Inorder traversal visits left subtree, node, then right subtree.
What order does preorder traversal use?
A Node, left, right
B Left, node, right
C Left, right, node
D Right, node, left
Answer: A. Node, left, right. Preorder visits the node before its child subtrees.
What order does postorder traversal use?
A Node, left, right
B Left, node, right
C Left, right, node
D Node, right, left
Answer: C. Left, right, node. Postorder visits a node after its child subtrees.
Which data structure supports level order traversal?
A Stack
B Hash set
C Queue
D Disjoint set
Answer: C. Queue. Level order traversal visits nodes breadth first using a queue.
What does tree height measure?
A Number of leaf values
B Total number of edges only
C Maximum node degree
D Longest root to leaf path
Answer: D. Longest root to leaf path. Tree height is based on the longest path from root to leaf.
What defines a complete binary tree?
A Every node has two children
B Every leaf has same key
C Levels full except possibly last
D Only one level exists
Answer: C. Levels full except possibly last. A complete binary tree fills levels in order, with the last possibly partial.
What defines a full binary tree?
A Every level is full
B Every node has one child
C Keys are sorted in order
D Zero or two children
Answer: D. Zero or two children. A full binary tree has no node with exactly one child.
What property does a balanced tree maintain?
A Height grows logarithmically
B Every key is equal
C Every leaf has zero depth
D Sorted memory values
Answer: A. Height grows logarithmically. Balanced search trees keep height proportional to the logarithm of node count.
What is an AVL balance factor?
A Left height minus right height
B Number of nodes in tree
C Parent key minus child key
D Tree height times two
Answer: A. Left height minus right height. An AVL balance factor compares the heights of a node's subtrees.
What operation restores AVL balance?
A Hashing
B Linear probing
C Path compression
D Rotation
Answer: D. Rotation. AVL rotations restructure a local subtree after an update.
What ordering does a min heap satisfy?
A Parent no greater than children
B Left child always smaller
C All leaves sorted
D Root is largest key
Answer: A. Parent no greater than children. A min heap keeps each parent key no greater than its children.
What value is at a min heap root?
A Maximum value
B Most recent value
C Minimum value
D Median value always
Answer: C. Minimum value. The min heap property places a minimum element at its root.
What does extract min do?
A Removes and returns minimum
B Adds a new root
C Sorts the whole heap
D Deletes all leaves
Answer: A. Removes and returns minimum. Extract min removes the heap's smallest element and restores heap order.
What is heap insertion time?
A O(log n)
B O(1) always
C O(n squared)
D O(n)
Answer: A. O(log n). A newly inserted heap item may move along the tree height.
In a zero based heap array, left child of i is?
A 2i
B i plus 1
C i divided by two
D 2i plus 1
Answer: D. 2i plus 1. The common zero based layout places the left child at index two times i plus one.
What does a trie store efficiently?
A Only sorted numeric arrays
B Graph edge weights
C Heap priorities only
D Keys by shared prefixes
Answer: D. Keys by shared prefixes. Tries share prefixes among keys, often for strings.
What is a B tree designed to support?
A Only binary recursion
B Efficient multiway search
C Constant time range scans always
D A single root value
Answer: B. Efficient multiway search. B trees use multiple keys per node and support efficient ordered storage.
What feature helps red black trees stay balanced?
A Random key deletion
B Coloring rules on nodes
C A fixed maximum size
D Circular array storage
Answer: B. Coloring rules on nodes. Red black coloring rules constrain path lengths after updates.
What is an unbalanced BST worst case search time?
A O(1)
B O(n)
C O(log n) always
D O(n squared)
Answer: B. O(n). An unbalanced BST can degenerate into a chain and require linear search.
What can a tree rotation preserve?
A The exact tree shape
B Search key ordering
C Every node's depth
D Insertion order
Answer: B. Search key ordering. A valid BST rotation changes shape while preserving its in-order key order.