«
»

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

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: Direct addressing is possible only when we can afford to allocate an array that has one position for every possible key.

2. 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, it is better to use direct addressing when the universe of keys is small as the array size grows with the increase in number of keys.

3. What is the search complexity in direct addressing?
a) O(n)
b) O(logn)
c) O(nlogn)
d) O(1)

Explanation: Since every key has a unique array position, searching takes a constant time.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. 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: As every key has a unique array position, it takes constant time to insert an element.

5. 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: Using a dynamic set, the size of the array is restricted to the number of keys, hence saves space. The complexity to implement dynamic array is larger than in normal case.

6. 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: As every key has a unique array position, it takes constant time to delete an element, although the deleted position must be specified by nil.

7. 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 of only 0s and 1s, a bit vector of length m takes much less space than an array of m pointers. The complexity to implement bit vector is larger than in normal case.

Sanfoundry Global Education & Learning Series – Data Structure.

To practice all areas of Data Structure, here is complete set of 1000+ Multiple Choice Questions and Answers. 