Skip to main content

Data Structures MCQs with Answers

Practice important Data Structures MCQs with answers and explanations.

Chapter: 43
Q661:
How does Quadratic Probing resolve collisions differently from Linear Probing?
A. It adds the square of the probe number to the index
B. It uses a linked list to store data
C. It searches for the next empty slot sequentially
D. It rehashes the data with a new hash function
Correct Answer: A
Chapter: 43
Q662:
What is a characteristic of Linked List Chaining in hash tables?
A. It stores data in a list at each index
B. It stores data sequentially in the table
C. It uses multiple hash functions
D. It avoids all collisions
Correct Answer: B
Chapter: 43
Q663:
When using hashing with linked lists, what happens when two keys hash to the same index?
A. Both keys are stored in a linked list at that index
B. The second key overwrites the first
C. The second key is stored in the next available slot
D. The first key is removed and replaced with the second key
Correct Answer: A
Chapter: 43
Q664:
What is the typical hash function used in hashing animations mentioned in the content?
A. `mod 10`
B. `mod 50`
C. `mod 75`
D. `mod 100`
Correct Answer: D
Chapter: 43
Q665:
In the given hashing animation example, how is the hash value determined?
A. By adding a constant to the key
B. By multiplying the key by a constant
C. By taking the modulus of the key with a number
D. By applying a series of hash functions
Correct Answer: C
Chapter: 43
Q666:
What issue is commonly observed when using Linear Probing for collision resolution?
A. Clustering of keys
B. Underflow of the hash table
C. Overflow of the hash table
D. Hash values are not unique
Correct Answer: A
Chapter: 43
Q667:
How does Quadratic Probing handle collisions differently from Linear Probing?
A. It uses quadratic increments to resolve collisions
B. It uses linear increments
C. It stores colliding keys in a linked list
D. It rehashes the keys with a new hash function
Correct Answer: A
Chapter: 43
Q668:
Which of the following is a situation where hashing is highly useful?
A. When frequent searches are needed in a stable table
B. When frequent insertions and deletions are required
C. When entries need to be sorted
D. When table traversal is needed
Correct Answer: A
Chapter: 43
Q669:
Why might hashing not be suitable when the data needs to be sorted?
A. Hash tables do not maintain order
B. Sorting is faster with hash tables
C. Hash tables are always sorted by default
D. Hashing algorithms sort data automatically
Correct Answer: A
Chapter: 43
Q670:
What is a key advantage of using hash tables for spell checking?
A. Hash tables provide constant time lookup for words
B. Hash tables sort words alphabetically
C. Hash tables correct spelling mistakes automatically
D. Hash tables are faster than other data structures
Correct Answer: A
Chapter: 43
Q671:
How can hashing be applied in game playing programs?
A. To store and quickly retrieve previously encountered positions
B. To calculate the minimum value in a position
C. To sort game positions
D. To track the time taken for moves
Correct Answer: A
Chapter: 43
Q672:
What is the main application of hashing in compiler design?
A. To keep track of declared variables in the symbol table
B. To sort variable names alphabetically
C. To resolve syntax errors
D. To optimize code execution
Correct Answer: A
Chapter: 43
Q673:
Which sorting algorithm selects the smallest element and places it in its correct position?
A. Bubble Sort
B. Insertion Sort
C. Selection Sort
D. Merge Sort
Correct Answer: C
Chapter: 43
Q674:
What is the basic concept of Selection Sort?
A. Find the smallest element and place it in the first position
B. Sort elements by comparing adjacent pairs
C. Insert elements into their sorted positions
D. Divide the array and sort each part individually
Correct Answer: A
Chapter: 44
Q675:
What is the main idea behind selection sort?
A. Swap largest element to the end
B. Find the smallest element and move it to the beginning
C. Insert elements in sorted order
D. Compare and swap neighboring elements
Correct Answer: B
Chapter: 44
Q676:
What is the time complexity of selection sort?
A. O(N)
B. O(N log N)
C. O(N^2)
D. O(log N)
Correct Answer: C
Chapter: 44
Q677:
What does the findIndexMin function do in the selection sort algorithm?
A. Finds the index of the largest element
B. Finds the index of the smallest element
C. Swaps two elements
D. Inserts an element into its correct position
Correct Answer: B
Chapter: 44
Q678:
In insertion sort, how is the array sorted?
A. By swapping neighboring elements
B. By inserting elements into the correct position among the already sorted elements
C. By finding and moving the smallest element to the start
D. By repeatedly comparing and swapping adjacent elements
Correct Answer: B
Chapter: 44
Q679:
What is the primary overhead of insertion sort?
A. Memory usage
B. Number of swaps
C. Number of comparisons
D. Time complexity due to shifting elements
Correct Answer: D
Chapter: 44
Q680:
Which sorting algorithm is described as having a "bubbling" nature?
A. Selection Sort
B. Insertion Sort
C. Bubble Sort
D. Merge Sort
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Data Structures

🚀 Start Quiz Now