This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Direct Addressing Tables”.

1. What is the advantage of using a dynamic set in direct addressing?
A) It saves time
B) It saves space
C) It saves both time and space
D) It reduces code complexity

Explanation: The size of the array is limited to the number of keys when using a dynamic set, which saves space. The complexity of implementing a dynamic array is higher than in a typical situation.

2. What is the time complexity to delete an element from the direct address table?
A) O(n)
B) O(logn)
C) O(nlogn)
D) O(1)

Explanation: Since each key has a specific array location, deleting an element takes a constant amount of time, even though the deleted position must be defined by zero.

3. How is a bit vector better compared to a normal array for implementing the hash table?
A) It saves time
B) It saves space
C) It saves both time and space
D) It reduces code complexity

Explanation: A bit vector is an array of bits consisting solely of 0s and 1s; a bit vector of length m takes up much less space than an array of m pointers. The complexity of implementing a bit vector is higher than in a typical situation.

A) Distinct array position for every possible key
B) Fewer array positions than keys
C) Fewer keys than array positions
D) Distinct array positions for keys based on priority

Explanation: Only when we can afford to assign an array with one location per each possible key is direct addressing possible.

5. When is it appropriate to use direct addressing?
A) When the array is comparatively large
B) When the universe U of keys is reasonably small
C) When the universe U of keys is reasonably large
D) When the array is comparatively small

Explanation: Since each key is associated with a slot in the array, direct addressing is preferable when the universe of keys is limited, as the array size increases as the number of keys grows.

6. What is the search complexity in direct addressing?
A) O(n)
B) O(logn)
C) O(nlogn)
D) O(1)

Explanation: Searching takes a constant amount of time since each key has a specific array location.

7. What is the time complexity to insert an element into the direct address table?
A) O(n)
B) O(logn)
C) O(nlogn)
D) O(1)

Explanation: Inserting an element takes time since each key has a specific array location.

A Direct Address Table (DAT) is a data structure that uses arrays to map records to their corresponding keys. Records are stored in direct address tables using their main values as indexes. They make quick searches, insertions, and deletions possible. When the number of possible keys is high, or when the number of keys currently stored is large, direct-address tables are inefficient. Instead of storing the element with key k in slot k, we store it in slot h in hash tables (k).