MCQOPTIONS
Saved Bookmarks
This section includes 125 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures Mcqs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
The second largest number from a set of n distinct numbers can be found in |
| A. | O(n) |
| B. | O(2n) |
| C. | O(n^2) |
| D. | O(log n) |
| Answer» B. O(2n) | |
| 2. |
A desirable choice for the partitioning element in quick sort is |
| A. | First element of the list |
| B. | Last element of the list |
| C. | Randomly chosen element of the list |
| D. | Median of the list |
| Answer» B. Last element of the list | |
| 3. |
A character of the data that binary search uses but the linear search ignores, is |
| A. | Maximum value in the list |
| B. | Minimum value in list |
| C. | Length of the list |
| D. | Order of the list |
| Answer» E. | |
| 4. |
A characteristic of the data that binary search uses but the linear search ignores is the___________. |
| A. | Order of the elements of the list. |
| B. | Length of the list. |
| C. | Maximum value in list. |
| D. | Type of elements of the list. |
| Answer» B. Length of the list. | |
| 5. |
A pivot element to partition unsorted list is used in |
| A. | Merge Sort |
| B. | Quick Sort |
| C. | Insertion Sort |
| D. | Selection Sort |
| Answer» C. Insertion Sort | |
| 6. |
A search begins the search with the element that is located in the middle of the array |
| A. | Serial |
| B. | Binary |
| C. | Parallel |
| D. | Random |
| Answer» C. Parallel | |
| 7. |
A sort which relatively passes through a list to exchange the first element with any element less than it and then repeats with a new first element is called |
| A. | Insertion sort |
| B. | Selection sort |
| C. | Heap sort |
| D. | Quick sort |
| Answer» E. | |
| 8. |
Which one of the below is not divide and conquer approach? |
| A. | Insertion Sort |
| B. | Merge Sort |
| C. | Shell Sort |
| D. | Heap Sort |
| Answer» C. Shell Sort | |
| 9. |
A sorted file contains 16 items. Using binary search, the maximum number of comparisons to search for an item in this file is .. |
| A. | 15 |
| B. | 8 |
| C. | 1 |
| D. | 4 |
| Answer» E. | |
| 10. |
Which sorting algorithm is the best if the list is already in order? |
| A. | Quick sort |
| B. | Merge sort |
| C. | Insertion sort |
| D. | None of these |
| Answer» D. None of these | |
| 11. |
Which is the easiest and least efficient searching technique? |
| A. | Fibonacci search |
| B. | Binary search |
| C. | Linear search |
| D. | None of the above |
| Answer» D. None of the above | |
| 12. |
Which of the below given sorting techniques has highest best-case runtime complexity |
| A. | Quick sort |
| B. | Selection sort |
| C. | Insertion sort |
| D. | Bubble sort |
| Answer» C. Insertion sort | |
| 13. |
Which of the below mentioned sorting algorithms are not stable? |
| A. | Selection Sort |
| B. | Bubble Sort |
| C. | Merge Sort |
| D. | Insertion Sort |
| Answer» B. Bubble Sort | |
| 14. |
Which of the following algorithm design technique is used in the quick sort algorithm? |
| A. | Backtracking |
| B. | Greedy method |
| C. | Divide and conquer |
| D. | Dynamic programming |
| Answer» B. Greedy method | |
| 15. |
Which of the following algorithm does not divide the list |
| A. | Linear search |
| B. | Binary search |
| C. | Merge sort |
| D. | Quick sort |
| Answer» B. Binary search | |
| 16. |
Which of the following algorithm is not stable? |
| A. | Bubble Sort |
| B. | Quick Sort |
| C. | Merge Sort |
| D. | Insertion Sort |
| Answer» C. Merge Sort | |
| 17. |
Which of the following code performs the partition operation in QuickSort? |
| A. | A |
| B. | B |
| C. | C |
| D. | D |
| Answer» C. C | |
| 18. |
Which of the following has search efficiency of (1) |
| A. | Tree |
| B. | Heap |
| C. | Hash Table |
| D. | Linked-List |
| Answer» D. Linked-List | |
| 19. |
Which of the following is a suitable lookup table that can be used in the uniform binary search?(N is the number of elements in the array and the delta array is global) |
| A. | A |
| B. | B |
| C. | C |
| D. | D |
| Answer» B. B | |
| 20. |
Which of the following is an example of in-place algorithm? |
| A. | Bubble Sort |
| B. | Merge Sort |
| C. | Insertion Sort |
| D. | None of the above |
| Answer» C. Insertion Sort | |
| 21. |
Which of the following is not the internal sort? |
| A. | Insertion Sort |
| B. | Bubble Sort |
| C. | Merge Sort |
| D. | Heap Sort |
| Answer» D. Heap Sort | |
| 22. |
Which of the following is useful in implementing quick sort? |
| A. | Set |
| B. | List |
| C. | Stacks |
| D. | Queue |
| Answer» D. Queue | |
| 23. |
Which of the following searching techniques do not require the data to be in sorted form |
| A. | Binary Search |
| B. | Interpolation Search |
| C. | Linear Search |
| D. | All of the above |
| Answer» D. All of the above | |
| 24. |
Which of the following sorting algorithms does not have a worst case running time of O (n^2) ? |
| A. | Insertion sort |
| B. | Merge sort |
| C. | Quick sort |
| D. | Bubble sort |
| Answer» C. Quick sort | |
| 25. |
Which of the following sorting algorithm is stable ? |
| A. | Insertion sort |
| B. | Bubble sort |
| C. | Quick sort |
| D. | Heap sort |
| Answer» E. | |
| 26. |
Which of the following sorting method is stable ? |
| A. | Shell sort |
| B. | Heap sort |
| C. | Binary insertion sort |
| D. | Straight insertion sort |
| Answer» E. | |
| 27. |
Which of the following sorting algorithm has the worst time complexity of n log(n)? |
| A. | Heap sort |
| B. | Quick sort |
| C. | Selection sort |
| D. | Insertion sort |
| Answer» B. Quick sort | |
| 28. |
Which of the following sorting methods sorts a given set of items that is already in sorted order or in reverse sorted order with equal speed? |
| A. | Heap sort |
| B. | Quick sort |
| C. | Selection sort |
| D. | Insertion sort |
| Answer» C. Selection sort | |
| 29. |
Which of the following sorting procedure is the slowest ? |
| A. | Shell sort |
| B. | Heap sort |
| C. | Quick sort |
| D. | Bubble sort |
| Answer» B. Heap sort | |
| 30. |
Which of the following statements is correct?(i) Sorting is also often used to produce human-readable output.(ii) The output should not be a permutation or reordering of the input. |
| A. | (ii) only |
| B. | (i) only |
| C. | Both are correct |
| D. | None is correct |
| Answer» C. Both are correct | |
| 31. |
Which of the following statements is used in the binary search algorithm to halve the array ? |
| A. | Middle Sub = middle Sub/2, |
| B. | Middle Sub = (stop Sub - start Sub)/2, |
| C. | Middle Sub = start Sub + stop Sub/2, |
| D. | Middle Sub = (start Sub + stop Sub)/2, |
| Answer» E. | |
| 32. |
Which technique is suitable for performing a search in a small array or in an unsorted array? |
| A. | Binary search |
| B. | Traversing |
| C. | Linear search |
| D. | Sums |
| Answer» D. Sums | |
| 33. |
Write a function for the Fibonacci search method. |
| A. | A |
| B. | B |
| C. | C |
| D. | D |
| Answer» B. B | |
| 34. |
You have to sort a list L consisting of a sorted list followed by a few random elements. Which of the following sorting methods would be especially suitable for such a task? |
| A. | Bubble sort |
| B. | Selection sort |
| C. | Quick sort |
| D. | Insertion sort |
| Answer» E. | |
| 35. |
_________is efficient for data sets which are already substantially sorted. The time complexity is O(n + d), where d is the number of inversions. |
| A. | Insertion sort |
| B. | Sorted array |
| C. | Unsorted array |
| D. | None of the above |
| Answer» B. Sorted array | |
| 36. |
__________ refers to the set of all possible solutions to a problem. |
| A. | External searching |
| B. | Brute-force search |
| C. | Search space |
| D. | None of the above |
| Answer» D. None of the above | |
| 37. |
___________ is a method of arranging keys in a file in the ascending or descending order. |
| A. | Lexicographical orders |
| B. | Library sort |
| C. | Algorithm |
| D. | Sorting |
| Answer» E. | |
| 38. |
___________ is a simple sorting technique to sort a list of elements. |
| A. | Insertion sort |
| B. | Selection sort |
| C. | Sorting array |
| D. | None of the above |
| Answer» C. Sorting array | |
| 39. |
Fibonaccian search, also referred to as Fibonacci search, is a ________algorithm for searching a sorted array by narrowing possible locations to progressively smaller intervals. |
| A. | Divide-and-rule |
| B. | Divide-and-conquer |
| C. | Divide-and-fall |
| D. | None of the above |
| Answer» C. Divide-and-fall | |
| 40. |
For a binary search algorithm to work, it is necessary that the array must be |
| A. | Sorted |
| B. | Unsorted |
| C. | In a heap |
| D. | Popped out of stack |
| Answer» B. Unsorted | |
| 41. |
For merging two sorted lists of sizes m and n into a sorted list of size m + n, we require comparisons of |
| A. | O(m) |
| B. | O(n) |
| C. | O(m+n) |
| D. | O(log(m) + log(n)) |
| Answer» D. O(log(m) + log(n)) | |
| 42. |
How many swaps are required to sort the given array using bubble sort { 2, 5, 1, 3, 4} ? |
| A. | 4 |
| B. | 5 |
| C. | 6 |
| D. | 7 |
| Answer» B. 5 | |
| 43. |
If h is any hashing function and is used to hash n keys in to a table of size m, where n |
| A. | Less than 1 |
| B. | Less than n |
| C. | Less than m |
| D. | Less than n/2 |
| Answer» B. Less than n | |
| 44. |
If the binary search algorithm determines that the search argument is in the lower half of the array, which of the following statements will, set the appropriate variable to the appropriate value? |
| A. | Stop Sub = middle Sub - 1, |
| B. | Stop Sub = middle Sub + 1. |
| C. | Start Sub = middle Sub - 1, |
| D. | Start Sub = middle Sub + 1, |
| Answer» E. | |
| 45. |
In abstract terms, each iteration of insertion sort removes an element from the input data andthen inserts it into the correct position in the _________ that is already sorted. |
| A. | List |
| B. | Stack |
| C. | String |
| D. | Array |
| Answer» B. Stack | |
| 46. |
In binary search, average number of comparison required for searching an element in a list if n numbers is |
| A. | Log2 n |
| B. | N /2 |
| C. | N |
| D. | N-1 |
| Answer» B. N /2 | |
| 47. |
In computer science, what is of immense importance and is one of the most extensively researched subjects? |
| A. | Sorting |
| B. | Searching |
| C. | Both (a) and (b) |
| D. | Inflecting |
| Answer» D. Inflecting | |
| 48. |
In general, the binary search method needs no more than . comparisons. |
| A. | [log2n]-1 |
| B. | [logn]+1 |
| C. | [log2n] |
| D. | [log2n]+1 |
| Answer» E. | |
| 49. |
In which field, a sorting algorithm refers to an algorithm the function of which is to put elements of a list in a certain order? |
| A. | Computer science |
| B. | Mathematics |
| C. | Both (a) and (b) |
| D. | Data structures |
| Answer» D. Data structures | |
| 50. |
In worst case Quick Sort has order |
| A. | O (n log n) |
| B. | O (n^2 /2) |
| C. | O (log n) |
| D. | O (n^2 /4) |
| Answer» C. O (log n) | |