Unit_C

Page 1

UNIT-6 Searching And Sorting Techniques Q.1 The __________ refers to the operation of arranging data in some given order, such as increasing or decreasing. (a) sorting (b) searching (c) merging Q.2 Which sorting technique needs to scan through the entire array and swap adjacent elements whenever required? (a) Bubble Sort (b) Selection Sort (c) Insertion Sort Q.3 The number of moves required for sorting an array using the Bubble Sort is (a) O (n2) (b) O (Log (n) (c) O (n) Q.4 The technique which involves selecting the minimum element is (a) Bubble Sort (b) Selection Sort (c) Insertion Sort Q.5 The number of moves required for sorting an array using the Selection Sort is (a) O (n) (b) O (Log (n) (c) O (n2) Q.6 __________sort works by considering the elements one at a time and inserting the element in its proper place among those already considered. (a) Bubble Sort (b) Selection Sort (c) Insertion Sort Q.7 Factors that help in deciding the sorting algorithm to be used are (a) Memory (b) Performance (c) Flexibility (d) All Q.8 Which Sorting technique is simplest to use? (a) Bubble Sort (b) Selection Sort (c) Insertion Sort (d) Quick Sort Q.9 Which searching technique is the best among the three searching techniques? (a) Quick Search (b) Binary Search (c) Linear Search Q.10.In __________search, as the number of elements increases, the time taken to perform the search increases linearly. (a) Quick Search (b) Binary Search (c) Linear Search Q.11 The linear search requires __________comparisons in the worst case. (a) N (b) N*N (c) log (N)


Q.12 __________search works by comparing your search element with the center element of the array. (a) Quick Search (b) Binary Search (c) Linear Search Q.14 The disadvantage of binary search is (a) Takes more time (b) Complexity is high (c) The array has to be in the sorted order Q.14 Which sorting technique is the best one? (a) Merge Sort (b) Quick Sort (c) Selection Sort Q.15 Which sorting technique makes use of a pivot element? (a) Merge Sort (b) Quick Sort (c) Selection Sort Q.16 Which sorting technique is the fastest one? (a) Quick Sort (b) Merge Sort (c) Insertion Sort Q.17 What is the best-case time complexity of linear search? (a) 1 (b) O (log (n)) (c) O (n) Q.18 What is the average-case time complexity of linear search? (a) 1 (b) O (log (n)) (c) O (n) Q.19 What is the worst-case time complexity of linear search? (a) 1 (b) O(n) (c) O(n2) Q.20 What is the best-case time complexity of binary search? (a) 1 (b) O (log (n)) (c) O (n2) Q.21 What is the worst-case time complexity of binary search? (a) 1 (b) O (log (n)) (c) O (n2) Q.22 What is the average-case time complexity of binary search? (a) 1 (b) O(log(n)) (c) O(n2) Q.23 _________refers to finding whether a data item is present in the set of items or not. (a) Searching (b) Sorting (c) Merging Q.24 The time required to search depends on the following factors: (a) Whether the data is arranged in a particular order or not (b) The location of the data to be searched 101


(c) The total number of searches to be done (d) All Q.25 When the data is arranged in a particular order then the time taken to search for the item is (a) more (b) less (c) cannot say Q.26 In __________.search, the searching process starts from the first item. (a) binary (b) linear (c) quick Q.27 A__________search is a searching technique that can be applied only to a sorted list of items. (a) binary search (b) linear search (c) quick search Q.28 Which searching technique is also called dictionary search? (a) Binary Search (b) Linear Search (c) Quick Search Q.29 Binary Search can be applied to sorted and unsorted lists. (a) Yes (b) No Q.30 _________searching technique can be applied to both sorted and unsorted list. (a) Binary Search (b) Linear Search (c) Quick Search Q.31 Searching time is less for (a) quick search (b) linear search (c) binary search Q.32 What is the average-case time complexity of bubble sort? (a) 1 (b) O(log(n) (c) O(n2) Q.33 What is the worst-case time complexity of bubble sort? (a) 1 (b) O(n) (c) O(n2) Q.34 What is the best-case time complexity of bubble sort? (a) O(n) (b) O (nlog (n) (c) O (n2) Q.35 What is the worst-case time complexity of insertion sort? (a) 1 (b) O(log(n) (c) O(n2) Q.36 What is the average-case time complexity of insertion sort? (a) 1 (b) O (log(n) (c) O(n2) 102


Q.37 What is the best-case time complexity of selection sort? (a) 1 (b) O (nlog (n) (c) O (n2) Q.38 What is the average-case time complexity of selection sort? (a) 1 (b) O (log (n)) (c) O (n2) Q.39 What is the worst-case time complexity of selection sort? (a) 1 (b) O (n) (c) O (n2) Q.40 What is the best-case time complexity of quick sort? (a) 1 (b) O (nlog (n) (c) O (n2) Q.41 What is the average-case time complexity of quick sort? (a) 1 (b) O (log (n) (c) O (n2) Q.42 What is the worst-case time complexity of quick sort? (a) 1 (b) O (n) (c) O (n2) Q.43 What is the average- case time complexity of merge sort? (a) 1 (b) O (nlog (n) (c) O (n2) Q.44 Merge sort is also called (a) partition exchange Sort (b) exchange sort (c) binary sort Q.45 Bubble sort is also called (a) partition exchange sort (b) exchange sort (c) binary sort Q.46 Time complexity is inversely proportional to (a) space complexity (b) diverse complexity (c) none Q.47 What is the worst-case time complexity of merge sort? (a) 1 (b) O (nlogn) (c) O (n2) Q.48 Bubble sort is yet another sorting technique which works on the design of (a) Brute force (b) greedy technique (c) divide and conquer (d) dynamic programming Q.49 What are the methods available in storing sequential files? (a) Straight merging (b) Natural merging (c) Polyphase sort 103


(d) Distribution of Initial runs (e) All the above Q.50 Linear search works on the principle of (a) brute force (b) greedy technique (c) divide and conquer (d) dynamic programming Q.51 Linear search is also called (a) sequential search (b) binary search (c) both (d) none Q.5 Binary search works on the strategy of (a) divide and conquer (b) brute force (c) greedy technique (d) dynamic programming Q.53 Bubble sort is yet another sorting technique which works on the design of (a) brute force (b) greedy technique (c) divide and conquer (d) dynamic programming Answers 1. 5. 9. 13. 17. 21. 25. 29. 33. 37. 41. 45. 49. 53.

(a) (d) (b) (c) (a) (c) (b) (b) (c) (c) (c) (b) (e) (a)

2. 6. 10. 14. 18. 22. 26. 30. 34. 38. 42. 46. 50.

(a) (c) (c) (b) (c) (c) (b) (b) (c) (c) (c) (a) (a)

3. 7. 11. 15. 19. 23. 27. 31. 35. 39. 43. 47. 51.

104

(a) (d) (a) (b) (b) (a) (a) (c) (c) (c) (b) (c) (a)

4. 8. 12. 16. 20. 24. 28. 32. 36. 40. 44. 48. 52.

(b) (a) (b) (a) (b) (d) (a) (c) (c) (b) (a) (a) (a)


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.