Data Structures MCQs with Answers
Practice important Data Structures MCQs with answers and explanations.
Multiple Choice Questions
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
View Answer
A
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
View Answer
A
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
View Answer
C
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
View Answer
A
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
View Answer
B
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)
View Answer
C
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
View Answer
B
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
View Answer
B
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
View Answer
D
Q680: Which sorting algorithm is described as having a "bubbling" nature?
- A: Selection Sort
- B: Insertion Sort
- C: Bubble Sort
- D: Merge Sort
View Answer
C