B-trees and B+ trees MCQs

By: Prof. Dr. Fazal Rehman Shamil | Last updated: September 20, 2024

What is a B-tree?
A) A balanced search tree with multiple keys per node
B) A binary search tree
C) A tree with only two children per node
D) A linear data structure
Answer: A) A balanced search tree with multiple keys per node

What is the main purpose of B-trees?
A) To perform in-memory sorting
B) To provide efficient access to disk-based data
C) To store data in a linear fashion
D) To represent hierarchical data
Answer: B) To provide efficient access to disk-based data

What property defines a B-tree?
A) All leaf nodes are at the same level
B) Each node has at most two children
C) All keys are stored in the leaf nodes
D) The tree is unbalanced
Answer: A) All leaf nodes are at the same level

In a B-tree, what is the maximum number of children a node can have?
A) 2
B) m (where m is the order of the tree)
C) 3
D) 4
Answer: B) m (where m is the order of the tree)

What is a B+ tree?
A) A variation of a B-tree that stores data only in leaf nodes
B) A binary search tree
C) A tree where each internal node can store only one key
D) A tree with only one child per node
Answer: A) A variation of a B-tree that stores data only in leaf nodes

How are B-trees and B+ trees different in terms of storage?
A) B-trees store keys in all nodes, while B+ trees store keys only in leaves
B) B+ trees can have fewer keys than B-trees
C) B-trees do not allow duplicate keys, while B+ trees do
D) B+ trees are always deeper than B-trees
Answer: A) B-trees store keys in all nodes, while B+ trees store keys only in leaves

What is the height of a B-tree with a large number of keys?
A) Very high
B) Constant
C) Logarithmic
D) Linear
Answer: C) Logarithmic

What happens to a B-tree when it becomes full?
A) It cannot store any more data
B) A new level is created
C) It merges with a sibling
D) It converts to a binary tree
Answer: B) A new level is created

Which of the following operations is more efficient in a B+ tree compared to a B-tree?
A) Searching
B) Insertion
C) Deletion
D) None of the above
Answer: A) Searching

What is the minimum degree of a B-tree?
A) 1
B) 2
C) 3
D) m/2, where m is the order of the tree
Answer: D) m/2, where m is the order of the tree

How does a B+ tree ensure that all leaf nodes are at the same level?
A) By balancing during insertion
B) By allowing only one key in internal nodes
C) By deleting excess nodes
D) By not allowing duplicates
Answer: A) By balancing during insertion

What is a significant advantage of B+ trees over B-trees?
A) More efficient use of disk space
B) Faster search times due to linked leaves
C) Simplicity in implementation
D) Fewer nodes needed
Answer: B) Faster search times due to linked leaves

In a B-tree, how are keys organized within a node?
A) In random order
B) In a circular manner
C) In sorted order
D) In reverse order
Answer: C) In sorted order

What does the “order” of a B-tree refer to?
A) The number of keys in each node
B) The maximum number of children each node can have
C) The total number of nodes
D) The height of the tree
Answer: B) The maximum number of children each node can have

Which operation can cause a B-tree to split?
A) Searching
B) Inserting a key into a full node
C) Deleting a key
D) Balancing
Answer: B) Inserting a key into a full node

How is data retrieved from a B+ tree?
A) By searching the internal nodes only
B) By traversing leaf nodes in a linked manner
C) By searching all nodes
D) By using a binary search
Answer: B) By traversing leaf nodes in a linked manner

What is the maximum number of keys in a B-tree node with order m?
A) m
B) m – 1
C) m + 1
D) 2m
Answer: B) m – 1

Which type of tree is best suited for databases?
A) Binary trees
B) B-trees and B+ trees
C) AVL trees
D) Red-black trees
Answer: B) B-trees and B+ trees

In a B+ tree, how are the leaf nodes linked?
A) Randomly
B) By pointers
C) By their parent nodes
D) There is no linking
Answer: B) By pointers

Which operation is typically faster in a B+ tree compared to a B-tree?
A) Insertion
B) Deletion
C) Searching for a range of values
D) None of the above
Answer: C) Searching for a range of values

What does the term “node splitting” refer to in B-trees?
A) Dividing a full node into two nodes
B) Deleting a node
C) Merging nodes
D) Changing node values
Answer: A) Dividing a full node into two nodes

How does a B+ tree improve the efficiency of range queries?
A) By storing all keys in internal nodes
B) By linking leaf nodes for sequential access
C) By keeping duplicates
D) By reducing the height of the tree
Answer: B) By linking leaf nodes for sequential access

What is the relationship between the height of a B-tree and the number of keys it contains?
A) Height increases linearly with keys
B) Height decreases as keys increase
C) Height grows logarithmically with keys
D) Height is independent of the number of keys
Answer: C) Height grows logarithmically with keys

What happens during deletion in a B+ tree if a leaf node becomes underflowed?
A) The node is deleted
B) The node is merged with a sibling
C) A key is moved from a parent node
D) No action is taken
Answer: B) The node is merged with a sibling

In which scenario is a B-tree particularly useful?
A) When data fits entirely in RAM
B) When frequent disk accesses are required
C) When data is static
D) When data is sorted in-memory
Answer: B) When frequent disk accesses are required

What ensures that a B-tree remains balanced?
A) Random insertion of keys
B) Splitting and merging of nodes
C) Deleting keys
D) Rebalancing the tree manually
Answer: B) Splitting and merging of nodes

How does the B+ tree structure affect its performance?
A) It is less efficient than a B-tree
B) It provides faster searches due to linked leaves
C) It increases the height of the tree
D) It makes deletion easier
Answer: B) It provides faster searches due to linked leaves

What is the order of a B+ tree?
A) The number of keys in the leaf nodes
B) The maximum number of children per node
C) The total number of nodes in the tree
D) The height of the tree
Answer: B) The maximum number of children per node

Which traversal method is used in B-trees?
A) Pre-order traversal
B) In-order traversal
C) Level-order traversal
D) Post-order traversal
Answer: B) In-order traversal

What is the maximum number of keys in a B+ tree leaf node with order m?
A) m
B) m – 1
C) m + 1
D) 2m
Answer: B) m – 1

In B-trees, what ensures that data retrieval remains efficient?
A) Depth of the tree
B) Number of nodes
C) Height-balanced property
D) Number of children per node
Answer: C) Height-balanced property

What is the primary advantage of B+ trees over B-trees?
A) More keys can be stored
B) Simplicity in insertion
C) Faster search times for range queries
D) Better handling of duplicate keys
Answer: C) Faster search times for range queries

Which characteristic makes B-trees suitable for external storage?
A) Fixed node size
B) Variable node size
C) Balanced structure
D) Efficient use of disk blocks
Answer: D) Efficient use of disk blocks

In a B-tree, what is done if a key is deleted from a node that causes underflow?
A) Nothing, the key is just removed
B) A key is borrowed from a sibling
C) The node is split
D) The entire tree is rebalanced
Answer: B) A key is borrowed from a sibling

What is the advantage of linked leaves in B+ trees?
A) Improved memory usage
B) Faster insertions
C) Faster sequential access
D) Simplicity of structure
Answer: C) Faster sequential access

What is a common application of B-trees?
A) Data compression
B) Indexing in databases
C) Sorting algorithms
D) Network routing
Answer: B) Indexing in databases

What does it mean when a B-tree is “balanced”?
A) All keys are in sorted order
B) All leaf nodes are at the same level
C) There is an equal number of keys in each node
D) All nodes are fully populated
Answer: B) All leaf nodes are at the same level

What occurs when a B+ tree node is full during insertion?
A) The key is ignored
B) The node is deleted
C) The node splits and promotes a key
D) The tree is restructured
Answer: C) The node splits and promotes a key

In a B-tree, what is the minimum number of children for a non-root node?
A) 1
B) 2
C) m/2
D) 0
Answer: C) m/2

Which of the following is NOT true about B+ trees?
A) They are height-balanced
B) All keys are in internal nodes
C) They have linked leaf nodes
D) They provide efficient range queries
Answer: B) All keys are in internal nodes

What is the impact of having too many keys in a B-tree node?
A) Faster searches
B) Increased complexity in balancing
C) Slower performance
D) It becomes a B+ tree
Answer: B) Increased complexity in balancing

How are duplicates handled in B+ trees?
A) They are not allowed
B) They are stored in separate nodes
C) They can be stored in leaf nodes
D) All keys must be unique
Answer: C) They can be stored in leaf nodes

 

Data Structures MCQs

Basic Concepts

  1. Introduction to Data Structures
  2. Complexity Analysis MCQs

Linear Data Structures MCQs

  1. Arrays MCQs
  2. Linked Lists MCQs
  3. Stacks MCQs
  4. Queues MCQs

Non-Linear Data Structures MCQs

  1. Trees MCQs
  2. Heaps MCQs
  3. Graphs MCQs

Hashing MCQs MCQs

  1. Hash Tables

Sorting and Searching Algorithms MCQs 

  1. Sorting Algorithms MCQs
  2. Searching Algorithms MCQs

Miscellaneous

  1. Memory Management in data structures MCQs
  2. String Manipulation Algorithms MCQs
  1. Data Structures MCQs 1
  2. Data Structures MCQs 2
  3. Data Structures MCQs 3
  4. Data Structures MCQs 4
  5. Data Structures MCQs 5
  6. Stacks Solved MCQs
  7. Queues MCQs
  8. pointer mcqs
  9. Array MCQs