Computer

Searching & Sorting Algorithms MCQs with Answers

Which sorting algorithm is the most efficient for large datasets?
a) Bubble Sort
b) Merge Sort
c) Insertion Sort
d) QuickSort

Answer
b) Merge Sort

Which of the following is the time complexity of Bubble Sort in the worst case?
a) O(n)
b) O(n log n)
c) O(n²)
d) O(log n)

Answer
c) O(n²)

What is the time complexity of QuickSort in the average case?
a) O(n log n)
b) O(n²)
c) O(n)
d) O(1)

Answer
a) O(n log n)

Which sorting algorithm works by repeatedly swapping adjacent elements if they are in the wrong order?
a) QuickSort
b) Bubble Sort
c) Merge Sort
d) Selection Sort

Answer
b) Bubble Sort

Which search algorithm has a time complexity of O(log n)?
a) Linear Search
b) Binary Search
c) Jump Search
d) Exponential Search

Answer
b) Binary Search

Which sorting algorithm selects the smallest element from an unsorted list and places it at the beginning?
a) QuickSort
b) Merge Sort
c) Selection Sort
d) Insertion Sort

Answer
c) Selection Sort

What is the best-case time complexity of Insertion Sort?
a) O(n)
b) O(n²)
c) O(log n)
d) O(1)

Answer
a) O(n)

Which of the following is a stable sorting algorithm?
a) QuickSort
b) Merge Sort
c) Heap Sort
d) Selection Sort

Answer
b) Merge Sort

What is the time complexity of Linear Search?
a) O(n)
b) O(n log n)
c) O(log n)
d) O(1)

Answer
a) O(n)

Which sorting algorithm is typically used for small datasets due to its simplicity?
a) Merge Sort
b) QuickSort
c) Insertion Sort
d) Heap Sort

Answer
c) Insertion Sort

Which algorithm is used for finding the position of an element in a sorted array using divide and conquer?
a) Linear Search
b) Binary Search
c) Jump Search
d) Exponential Search

Answer
b) Binary Search

Which sorting algorithm is based on the divide-and-conquer paradigm?
a) Merge Sort
b) Selection Sort
c) Bubble Sort
d) Insertion Sort

Answer
a) Merge Sort

What is the space complexity of Merge Sort?
a) O(1)
b) O(n)
c) O(n log n)
d) O(log n)

Answer
b) O(n)

Which search algorithm works best on a sorted array with a known range of values?
a) Linear Search
b) Binary Search
c) Jump Search
d) Exponential Search

Answer
c) Jump Search

Which sorting algorithm repeatedly divides the array into two halves and then merges them in sorted order?
a) QuickSort
b) Merge Sort
c) Heap Sort
d) Bubble Sort

Answer
b) Merge Sort

Which of the following is the worst-case time complexity of QuickSort?
a) O(n log n)
b) O(n²)
c) O(n)
d) O(1)

Answer
b) O(n²)

Which of the following is true about Binary Search?
a) It can be used on unsorted arrays
b) It has a time complexity of O(n)
c) It requires a sorted array
d) It is not an efficient search algorithm

Answer
c) It requires a sorted array

Which algorithm is used to sort an array by repeatedly selecting the smallest element and placing it at the beginning of the unsorted part of the array?
a) Merge Sort
b) Insertion Sort
c) QuickSort
d) Selection Sort

Answer
d) Selection Sort

What is the time complexity of Merge Sort in the worst case?
a) O(n log n)
b) O(n²)
c) O(n)
d) O(1)

Answer
a) O(n log n)

Which search algorithm is best used for sorted arrays when you don’t know the position of the element?
a) Linear Search
b) Binary Search
c) Exponential Search
d) Jump Search

Answer
b) Binary Search

Which of the following best describes the efficiency of QuickSort in comparison to other sorting algorithms?
a) It is always the fastest
b) It is faster than Merge Sort in the average case
c) It is slower than Merge Sort in all cases
d) It has a guaranteed worst-case time complexity of O(n log n)

Answer
b) It is faster than Merge Sort in the average case

Which of the following sorting algorithms is NOT comparison-based?
a) QuickSort
b) Merge Sort
c) Counting Sort
d) Bubble Sort

Answer
c) Counting Sort

Which of the following algorithms can sort data without using extra space?
a) Merge Sort
b) QuickSort
c) Bubble Sort
d) Selection Sort

Answer
b) QuickSort

What is the average-case time complexity of Merge Sort?
a) O(n)
b) O(n²)
c) O(n log n)
d) O(1)

Answer
c) O(n log n)

Which algorithm is used when there is a large number of elements with a known, limited range?
a) QuickSort
b) Merge Sort
c) Counting Sort
d) Insertion Sort

Answer
c) Counting Sort

Which sorting algorithm is considered the most efficient for large datasets with small numbers of unique values?
a) QuickSort
b) Heap Sort
c) Radix Sort
d) Counting Sort

Answer
d) Counting Sort

Which search algorithm divides the array into halves and recursively searches each half?
a) Linear Search
b) Binary Search
c) Exponential Search
d) Jump Search

Answer
b) Binary Search

Which algorithm finds the smallest element in an unsorted list and places it in its correct position?
a) Selection Sort
b) Insertion Sort
c) QuickSort
d) Merge Sort

Answer
a) Selection Sort

What is the average time complexity of Selection Sort?
a) O(n log n)
b) O(n²)
c) O(n)
d) O(1)

Answer
b) O(n²)

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button