Python Programming (2180711) MCQs

MCQs of Simple Algorithms and Data structures

Showing 11 to 20 out of 29 Questions
11.
Binary Search can be categorized into which of the following?
(a) Brute Force technique
(b) Divide-and-conquer
(c) Greedy method
(d) Dynamic programming
Answer:

Option (b)

12.
Which of the following is not a stable sorting algorithm in its typical implementation.
(a) Insertion Sort
(b) Merge Sort
(c) Quick Sort
(d) Bubble Sort
Answer:

Option (c)

13.
Assume that we use Bubble Sort to sort n distinct elements in ascending order. When does the best case of Bubble Sort occur?
(a) When elements are sorted in ascending order
(b) When elements are sorted in descending order
(c) When elements are not sorted by any order
(d) There is no best case for Bubble Sort. It always takes O(n*n) time
Answer:

Option (a)

14.
Running merge sort on an array of size n which is already sorted is
(a) O(n)
(b) O(nlogn)
(c) O(n2)
(d) None
Answer:

Option (b)

15.
Which of the following is not a noncomparison sort?
(a) Counting sort
(b) Bucket sort
(c) Radix sort
(d) Shell sort
Answer:

Option (d)

16.
If the given input array is sorted or nearly sorted, which of the following algorithm gives the best performance?
(a) Insertion sort
(b) Selection sort
(c) Quick sort
(d) Merge sort
Answer:

Option (a)

17.
Which of the following algorithm design technique is used in the quick sort algorithm?
(a) Dynamic programming
(b) Backtracking
(c) Divide-and-conquer
(d) Greedy method
Answer:

Option (c)

18.
Merge sort uses
(a) Divide-and-conquer
(b) Backtracking
(c) Heuristic approach
(d) Greedy method
Answer:

Option (a)

19.
The given array is arr = {1,2,4,3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array?
(a) 4
(b) 2
(c) 1
(d) 0
Answer:

Option (a)

20.
Quick sort is also known as ……..
(a) merge sort
(b) tree sort
(c) shell sort
(d) partition and exchange sort
Answer:

Option (d)

Showing 11 to 20 out of 29 Questions