Data Structures MCQs (Part-5)

What is the primary characteristic of a binary search tree (BST)?

A Nodes have two children
B Unordered
C Nodes are ordered
D Balanced

Which operation ensures that an AVL tree remains balanced?

A Rotation
B Insertion
C Deletion
D Traversal

Which of the following properties is true for a Red-Black Tree?

A Nodes are always balanced
B The tree is never empty
C Each node has at most two children
D Every path from the root to the leaves contains the same number of black nodes

What is the worst-case time complexity of searching in an unbalanced binary search tree?

A O(log n)
B O(n)
C O(n log n)
D O(1)

What type of tree is used to implement associative arrays in many programming languages?

A AVL Tree
B B-Tree
C Red-Black Tree
D Binary Search Tree

In a Red-Black Tree, which of the following statements is true?

A Insertion
B All leaf nodes are black
C Deletion
D Searching

Which of the following is a key advantage of an AVL tree over a regular binary search tree?

A Automatic balancing
B Faster insertion
C Lower space complexity
D No rotations needed

What is the average time complexity for search operations in a balanced binary search tree?

A O(n)
B O(log n)
C O(1)
D O(n log n)

What does a left rotation operation do in an AVL tree?

A Reverses the order of nodes
B Balances the tree by changing the root
C Doubles the number of nodes
D Increases the height of the right subtree

What is the primary reason for using a Red-Black tree over an AVL tree in practice?

A Faster insertions
B Simpler balancing rules
C Lower space complexity
D More balanced tree structure

Which of the following operations is generally faster in a Red-Black Tree than in an AVL Tree?

A Insertion
B Deletion
C Searching
D All of the above

What is the time complexity of inserting a node into an AVL tree?

A O(log n)
B O(n)
C O(1)
D O(n log n)

Which of the following trees provides efficient search and is used in databases for disk-based indexing?

A AVL Tree
B Red-Black Tree
C B-Tree
D Binary Search Tree

What is the time complexity of searching for an element in a Red-Black tree?

A O(log n)
B O(n)
C O(1)
D O(n log n)

What happens if an AVL tree becomes unbalanced during an insertion operation?

A A Red-Black tree is used instead
B A left or right rotation is performed
C The tree is automatically resized
D The insertion fails