Q.1
Which of the following is correct with regard to insertion sort?
  • a) insertion sort is stable and it sorts In-place
  • b) insertion sort is unstable and it sorts In-place
  • c) insertion sort is stable and it does not sort In-place
  • d) insertion sort is unstable and it does not sort In-place
Q.2
Which of the following sorting algorithm is best suited if the elements are already sorted?
  • a) Heap Sort
  • b) Quick Sort
  • c) Insertion Sort
  • d) Merge Sort
Q.3
The worst case time complexity of insertion sort is O(n2). What will be the worst case time complexity of insertion sort if the correct position for inserting element is calculated using binary search?
  • a) O(nlogn)
  • b) O(n2)
  • c) O(n)
  • d) O(logn)
Q.4
Insertion sort is an example of an incremental algorithm.
  • a) True
  • b) False
Q.5
Consider the code given below, which runs insertion sort: void insertionSort(int arr[], int array_size) { int i, j, value; for (i =i < array_size; i++) { value = arr[i]; j = i; while (________ ) { arr[j] = arr[j − 1]; j = j − } arr[j] = value; } }
  • a) (j > 0) || (arr[j − 1] > value)
  • b) (j > 0) && (arr[j − 1] > value)
  • c) (j > 0) && (arr[j + 1] > value)
  • d) (j > 0) && (arr[j + 1] < value)
Q.6
Which of the following is good for sorting arrays having less thanelements?
  • a) Quick Sort
  • b) Selection Sort
  • c) Merge Sort
  • d) Insertion Sort
Q.7
Consider an array of lengtharr[= {9,7,4,2,1}. What are the steps of insertions done while running insertion sort on the array?
  • a) 7 9 4 2 1    4 7 9 2 1    2 4 7 9 1    1 2 4 7 9
  • b) 9 7 4 1 2    9 7 1 2 4    9 1 2 4 7    1 2 4 7 9
  • c) 7 4 2 1 9    4 2 1 9 7    2 1 9 7 4    1 9 7 4 2
  • d) 7 9 4 2 1    2 4 7 9 1    4 7 9 2 1    1 2 4 7 9
Q.8
StatementIn insertion sort, after m passes through the array, the first m elements are in sorted order.
  • a) Both the statements are true
  • b) Statement 1 is true but statement 2 is false
  • c) Statement 1 is false but statement 2 is true
  • d) Both the statements are false
Q.9
In insertion sort, the average number of comparisons required to place the 7th element into its correct position is ____
  • a) 9
  • b) 4
  • c) 7
  • d) 14
Q.10
Which of the following is not an exchange sort?
  • a) Bubble Sort
  • b) Quick Sort
  • c) Partition-exchange Sort
  • d) Insertion Sort
0 h : 0 m : 1 s