Vidyalelo
Data Structure · all questions

Sorting Algorithms
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

509

Questions

21/26

Page

Pick an option on a question to see the right answer and solution.

In the following scenarios, when will you use selection sort?

Select an option to see the answer and solution.

What is the first step in the algorithm of stooge sort(after base case)?

Select an option to see the answer and solution.

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 with improvised version?

Select an option to see the answer and solution.

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?

Select an option to see the answer and solution.

What will be the order of elements of the array arr = {23, 67, 143, 654, 43} after first iteration of MSD sort is complete?

Select an option to see the answer and solution.

Which of the following sorting algorithm is most closely related to the OS?

Select an option to see the answer and solution.

Why is Shell sort called as a generalization of Insertion sort?

Select an option to see the answer and solution.

Which of the following is an alternate name of MSD radix sort?

Select an option to see the answer and solution.

Given an array of the following elements
81, 94, 11, 96, 12, 35, 17, 95, 28, 58, 41, 75, 15.
What will be the sorted order after 5-sort?

Select an option to see the answer and solution.

What is the cut-off for switching from quick sort to insertion sort in the implementation of introsort?

Select an option to see the answer and solution.

Which of the following is not necessarily a stable sorting algorithm?

Select an option to see the answer and solution.

What is the average case complexity of bubble sort?

Select an option to see the answer and solution.

Comb sort is an improved version of . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the given C++ code?
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{ 
    int arr[] = {1, 3,4,2,5}; 
    int n = sizeof(arr)/sizeof(arr[0]);   
    sort(arr, arr+n); 
    int a;
    for ( a = 0; a< n; a++) 
        cout << arr[a] << " ";  
    return 0; 
}

Select an option to see the answer and solution.

Quick sort uses which of the following algorithm to implement sorting?

Select an option to see the answer and solution.

What is the worst case time complexity of cube sort?

Select an option to see the answer and solution.

What is the average time complexity of in place merge sort when we use the following function for merging?
void in_place_merge(int arr[], int l, int middle, int r) 
{ 
	int start2 = middle + 1; 
	if (arr[middle] <= arr[start2]) 
        { 
		return; 
	} 
	while (l <= middle && start2 <= r) 
        { 
		if (arr[l] <= arr[start2]) 
                { 
			l++; 
		} 
		else 
                { 
			int val = arr[start2]; 
			int index = start2; 
			while (index != l) 
                        { 
				arr[index] = arr[index - 1]; 
				index--; 
			} 
			arr[l] = val; 
		        l++; 
			middle++; 
			start2++; 
		} 
	} 
}

Select an option to see the answer and solution.

Merge sort can be implemented using O(1) auxiliary space.

Select an option to see the answer and solution.

What will be the best case time complexity of merge sort?

Select an option to see the answer and solution.

Quick sort uses join operation rather than merge operation.

Select an option to see the answer and solution.