InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 301. |
Quick sort uses which of the following method to implement sorting?(a) merging(b) partitioning(c) selection(d) exchangingThis question was addressed to me by my college professor while I was bunking the class.The doubt is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (b) partitioning |
|
| 302. |
What is the average time complexity of randomized quick sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)This question was addressed to me in examination.This intriguing question comes from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT option is (a) O(n LOG n) Best explanation: The average case TIME COMPLEXITY of RANDOMIZED quick sort is same as that of standard quick sort as randomized quick sort only helps in preventing the worst case. It is equal to O(n log n). |
|
| 303. |
What is the auxiliary space complexity of randomized quick sort?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)The question was posed to me in my homework.My question is based upon Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (C) O(LOG n) |
|
| 304. |
What is the purpose of using randomized quick sort over standard quick sort?(a) so as to avoid worst case time complexity(b) so as to avoid worst case space complexity(c) to improve accuracy of output(d) to improve average case time complexityThis question was addressed to me during an interview for a job.My question is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (a) so as to AVOID worst case time complexity |
|
| 305. |
What is a randomized quick sort?(a) quick sort with random partitions(b) quick sort with random choice of pivot(c) quick sort with random output(d) quick sort with random inputI got this question in an interview.This is a very interesting question from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (b) quick sort with RANDOM choice of pivot |
|
| 306. |
Quick sort uses which of the following algorithm to implement sorting?(a) backtracking(b) greedy algorithm(c) divide and conquer(d) dynamic programmingI have been asked this question in homework.The query is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT answer is (c) divide and conquer To EXPLAIN: Quick sort uses the technique of divide and conquer in order to sort a given array. It divides the array into two PARTS about the PIVOT and then apply a quick sort to both the parts. |
|
| 307. |
Which of the following is not true about QuickSort?(a) in-place algorithm(b) pivot position can be changed(c) adaptive sorting algorithm(d) can be implemented as a stable sortThis question was addressed to me in an online interview.The query is from Quicksort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right CHOICE is (B) pivot position can be changed |
|
| 308. |
The given array is arr = {2,6,1}. What are the pivots that are returned as a result of subsequent partitioning?(a) 1 and 6(b) 6 and 1(c) 2 and 6(d) 1I got this question in an internship interview.The origin of the question is Quicksort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (d) 1 |
|
| 309. |
What is the average case complexity of QuickSort?(a) O(nlogn)(b) O(logn)(c) O(n)(d) O(n^2)This question was addressed to me during an interview.I need to ask this question from Quicksort in division Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT answer is (a) O(nlogn) EASY explanation - The position of partition(split) is unknown, hence all(n) possibilities are CONSIDERED, the AVERAGE is found by adding all and DIVIDING by n. |
|
| 310. |
Quick sort is a space-optimised version of ____(a) Bubble sort(b) Selection sort(c) Insertion sort(d) Binary tree sortThe question was posed to me in class test.My question is from Quicksort in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (d) Binary tree sort |
|
| 311. |
Which one of the following sorting algorithm is best suited to sort an array of 1 million elements?(a) Bubble sort(b) Insertion sort(c) Merge sort(d) Quick sortThe question was asked in quiz.This intriguing question comes from Quicksort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (d) Quick sort |
|
| 312. |
A machine needs a minimum of 200 sec to sort 1000 elements by Quick sort. The minimum time needed to sort 200 elements will be approximately __________(a) 60.2 sec(b) 45.54 sec(c) 31.11 sec(d) 20 secThe question was asked in unit test.I need to ask this question from Quicksort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (c) 31.11 sec |
|
| 313. |
Consider the Quick sort algorithm which sorts elements in ascending order using the first element as pivot. Then which of the following input sequence will require a maximum number of comparisons when this algorithm is applied on it?(a) 22 25 56 67 89(b) 52 25 76 67 89(c) 22 25 76 67 50(d) 52 25 89 67 76This question was addressed to me in examination.Enquiry is from Quicksort in section Sorting of Data Structures & Algorithms II |
|
Answer» Right OPTION is (a) 22 25 56 67 89 |
|
| 314. |
Consider the Quick sort algorithm in which the partitioning procedure splits elements into two sub-arrays and each sub-array contains at least one-fourth of the elements. Let T(n) be the number of comparisons required to sort array of n elements. Then T(n) |
|
Answer» Right option is (B) T(n) <= T(n/4) + T(3n/4) + cn |
|
| 315. |
Quick sort is a stable sorting algorithm.(a) True(b) FalseI got this question in an interview.This intriguing question comes from Quicksort in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (B) False |
|
| 316. |
The best case behaviour occurs for quick sort is, if partition splits the array of size ninto __________(a) n/2 : (n/2) – 1(b) n/2 : n/3(c) n/4 : 3n/2(d) n/4 : 3n/4I have been asked this question during an interview.The question is from Quicksort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (a) n/2 : (n/2) – 1 |
|
| 317. |
Apply Quick sort on a given sequence 7 11 14 6 9 4 3 12. What is the sequence after first phase, pivot is first element?(a) 6 4 3 7 11 9 14 12(b) 6 3 4 7 9 14 11 12(c) 7 6 14 11 9 4 3 12(d) 7 6 4 3 9 14 11 12This question was addressed to me in semester exam.The above asked question is from Quicksort topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct ANSWER is (B) 6 3 4 7 9 14 11 12 |
|
| 318. |
What is the worst case time complexity of the Quick sort?(a) O(nlogn)(b) O(n)(c) O(n^3)(d) O(n^2)The question was posed to me in an interview.My doubt is from Quicksort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (d) O(N^2) |
|
| 319. |
Quick sort is a __________(a) greedy algorithm(b) divide and conquer algorithm(c) dynamic programming algorithm(d) backtracking algorithmI got this question in an interview for internship.My question comes from Quicksort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (b) DIVIDE and conquer ALGORITHM |
|
| 320. |
Which among the following is the best cut-off range to perform insertion sort within a quick sort?(a) N=0-5(b) N=5-20(c) N=20-30(d) N>30The question was asked in my homework.Origin of the question is Quicksort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT choice is (B) N=5-20 |
|
| 321. |
Which is the worst method of choosing a pivot element?(a) first element as pivot(b) last element as pivot(c) median-of-three partitioning(d) random element as pivotI got this question by my school principal while I was bunking the class.My doubt stems from Quicksort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right ANSWER is (a) FIRST ELEMENT as PIVOT |
|
| 322. |
How many sub arrays does the quick sort algorithm divide the entire array into?(a) one(b) two(c) three(d) fourThe question was asked in a job interview.My doubt is from Quicksort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (b) two |
|
| 323. |
Quick sort uses join operation rather than merge operation.(a) true(b) falseThis question was addressed to me in final exam.This is a very interesting question from Quicksort in division Sorting of Data Structures & Algorithms II |
|
Answer» Right answer is (a) true |
|
| 324. |
Which of the following sorting algorithms is used along with quick sort to sort the sub arrays?(a) Merge sort(b) Shell sort(c) Insertion sort(d) Bubble sortThe question was posed to me in homework.My question is from Quicksort topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct ANSWER is (c) INSERTION SORT |
|
| 325. |
What is the average running time of a quick sort algorithm?(a) O(N^2)(b) O(N)(c) O(N log N)(d) O(log N)I had been asked this question during an interview.The above asked question is from Quicksort in division Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (c) O(N log N) |
|
| 326. |
Which is the safest method to choose a pivot element?(a) choosing a random element as pivot(b) choosing the first element as pivot(c) choosing the last element as pivot(d) median-of-three partitioning methodI got this question in an internship interview.Question is taken from Quicksort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (a) choosing a random ELEMENT as pivot |
|
| 327. |
Which of the following methods is the most effective for picking the pivot element?(a) first element(b) last element(c) median-of-three partitioning(d) random elementThe question was posed to me by my college director while I was bunking the class.My doubt is from Quicksort topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Correct option is (c) median-of-three partitioning |
|
| 328. |
What is the worst case time complexity of a quick sort algorithm?(a) O(N)(b) O(N log N)(c) O(N^2)(d) O(log N)I have been asked this question during an interview for a job.Origin of the question is Quicksort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (c) O(N^2) |
|
| 329. |
Quick sort follows Divide-and-Conquer strategy.(a) True(b) FalseThe question was asked in exam.The origin of the question is Quicksort in division Sorting of Data Structures & Algorithms II |
|
Answer» Correct OPTION is (a) True |
|
| 330. |
Which of the following sorting algorithms is the fastest?(a) Merge sort(b) Quick sort(c) Insertion sort(d) Shell sortThe question was posed to me in class test.The question is from Quicksort topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (b) Quick sort |
|
| 331. |
What is the average time complexity of bottom up merge sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)The question was asked by my college director while I was bunking the class.My question is based upon Sorting in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (a) O(n log n) |
|
| 332. |
What is the auxiliary space complexity of bottom up merge sort?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)The question was posed to me during an interview.The above asked question is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Right answer is (b) O(n) |
|
| 333. |
What is the auxiliary space complexity of standard merge sort?(a) O(1)(b) O(log n)(c) O(n)(d) O(n log n)The question was posed to me during an online exam.Enquiry is from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (C) O(n) |
|
| 334. |
What is the average case time complexity of standard merge sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)This question was addressed to me during an interview for a job.My question comes from Sorting topic in division Sorting of Data Structures & Algorithms II |
|
Answer» Right ANSWER is (a) O(N log n) |
|
| 335. |
Merge sort uses which of the following algorithm to implement sorting?(a) backtracking(b) greedy algorithm(c) divide and conquer(d) dynamic programmingI have been asked this question in homework.This question is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct option is (c) divide and conquer |
|
| 336. |
What is the space complexity of in place merge sort?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)This question was addressed to me in semester exam.This intriguing question comes from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (c) O(LOG N) |
|
| 337. |
What is the auxiliary space complexity of standard merge sort?(a) O(1)(b) O(log n)(c) O(n)(d) O(n log n)This question was posed to me during a job interview.My query is from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct ANSWER is (c) O(n) |
|
| 338. |
What is the average case time complexity of standard merge sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)The question was asked in an online quiz.This intriguing question originated from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right CHOICE is (a) O(n LOG n) |
|
| 339. |
Merge sort uses which of the following algorithm to implement sorting?(a) backtracking(b) greedy algorithm(c) divide and conquer(d) dynamic programmingThis question was addressed to me during an interview.The question is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (c) divide and conquer |
|
| 340. |
Which of the following is not a stable sorting algorithm?(a) Quick sort(b) Cocktail sort(c) Bubble sort(d) Merge sortI had been asked this question in an interview for job.Query is from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT answer is (a) QUICK sort The explanation is: Out of the given options quick sort is the only algorithm which is not STABLE. Merge sort is a stable SORTING algorithm. |
|
| 341. |
Which of the following is not in place sorting algorithm by default?(a) merge sort(b) quick sort(c) heap sort(d) insertion sortI had been asked this question during an internship interview.Origin of the question is Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (a) merge sort |
|
| 342. |
Choose the incorrect statement about merge sort from the following?(a) it is a comparison based sort(b) it is an adaptive algorithm(c) it is not an in place algorithm(d) it is stable algorithmThis question was posed to me during an internship interview.This key question is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT option is (B) it is an adaptive algorithm Explanation: Merge SORT is not an adaptive SORTING algorithm. This is because it takes O(N log n) time complexity irrespective of any case. |
|
| 343. |
Which of the following is not a variant of merge sort?(a) in-place merge sort(b) bottom up merge sort(c) top down merge sort(d) linear merge sortThis question was addressed to me in an interview for job.This intriguing question originated from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (d) linear merge sort |
|
| 344. |
What will be the best case time complexity of merge sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)I had been asked this question during an internship interview.The doubt is from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» Correct ANSWER is (a) O(N log n) |
|
| 345. |
Which of the following method is used for sorting in merge sort?(a) merging(b) partitioning(c) selection(d) exchangingThis question was posed to me during an interview for a job.I want to ask this question from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (a) merging |
|
| 346. |
What is the worst case time complexity of merge sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)This question was addressed to me during an online exam.My query is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (a) O(N LOG n) |
|
| 347. |
Merge sort can be implemented using O(1) auxiliary space.(a) true(b) falseI got this question in examination.My question is from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (a) true |
|
| 348. |
What is the auxiliary space complexity of merge sort?(a) O(1)(b) O(log n)(c) O(n)(d) O(n log n)The question was asked in final exam.The origin of the question is Sorting in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (c) O(n) |
|
| 349. |
What is the average case time complexity of merge sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)I had been asked this question during a job interview.This key question is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (a) O(N log n) |
|
| 350. |
Merge sort uses which of the following technique to implement sorting?(a) backtracking(b) greedy algorithm(c) divide and conquer(d) dynamic programmingThis question was addressed to me in an online quiz.My doubt stems from Sorting in division Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT answer is (c) divide and conquer For explanation: MERGE sort uses divide and conquer in order to sort a given array. This is because it divides the array into two halves and applies merge sort algorithm to each half INDIVIDUALLY after which the two sorted halves are MERGED together. |
|