DS Questions
DS Questions
Choices
A) The length of the path from the node to the root (answer)
B) Child node
C) Leaf node
D) Internal node
4. What is the term for an acyclic, connected graph with a specially designated root node
in data structures?
Choices
A) Node structure
B) Graph
C) Hierarchy
D) Tree (answer)
5. In a tree data structure, what is the term for a node with a child?
Choices
A) Child node
B) Root node
D) Leaf node
6. What is a tree in data structures?
● A. A linear data structure
● B. A hierarchical data structure
● C. A non-linear data structure
● D. Both B and C ( answer )
7. What is the time complexity to insert a node in a balanced binary search tree (AVL
tree)?
● A. O(log n) ( answer )
● B. O(n)
● C. O(n^2)
● D. O(1)
C) To store records with a key-value pair and quickly retrieve the value using the key
C) It is used to determine the index where a record will be stored in the array ( answer C)
A) Constant time complexity for basic operations like insertion and retrieval
B) It represents the value associated with each record in the hash table
D) It is used as input to a hashing function to determine the storage location of the record
)Answer D(
B) Some spots contain valid records, and other spots are 'empty'
C) 'Empty' spots are removed from the array to optimize storage space
D) 'Empty' spots are filled with placeholder values to maintain array consistency
)Answer B(
13.What is the role of the push_back method in the given C++ code?
14.What is the purpose of the Hash class in the given C++ code?
19.What does the leftRotate function in the given C++ AVL tree code do?
c. It computes the maximum height between the left and right subtrees.