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.
| 251. |
How many elements can be sorted in O(logn) time using Heap sort?(a) O(1)(b) O(n/2)(c) O(logn/log(logn))(d) O(logn)The question was asked during an interview for a job.Question is from Heapsort in division Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (c) O(logn/log(logn)) |
|
| 252. |
Introsort algorithm is combination of _____________(a) Quick sort and Heap sort(b) Quick sort and Shell sort(c) Heap sort and Merge sort(d) Heap sort and insertion sortThe question was asked in examination.My question comes from Heapsort in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (a) QUICK sort and HEAP sort |
|
| 253. |
Which one of the following is a variation of Heap sort?(a) Comb sort(b) Smooth sort(c) Binary tree sort(d) Shell sortThis question was posed to me in exam.Question is taken from Heapsort topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct ANSWER is (b) Smooth sort |
|
| 254. |
In average case Heap sort is as efficient as the Quick sort.(a) True(b) FalseI got this question in examination.The above asked question is from Heapsort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT option is (b) False For explanation: Quick sort is more EFFICIENT than Heap sort because EXPERIMENTS indicate that Heap sort requires twice as much TIME as Quick sort for randomly sorted INPUT. |
|
| 255. |
What is its wort case time complexity of Heap sort?(a) O(nlogn)(b) O(n^2logn)(c) O(n^2)(d) O(n^3)The question was asked in a national level competition.The above asked question is from Heapsort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (a) O(nlogn) |
|
| 256. |
The descending heap property is ___________(a) A[Parent(i)] = A[i](b) A[Parent(i)] = A[i](d) A[Parent(i)] > 2 * A[i]This question was posed to me in exam.Question is from Heapsort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (c) A[Parent(i)] >= A[i] |
|
| 257. |
The essential part of Heap sort is construction of max-heap. Consider the tree shown below, the node 24 violates the max-heap property. Once heapify procedure is applied to it, which position will it be in?(a) 4(b) 5(c) 8(d) 9I got this question in examination.My doubt stems from Heapsort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (d) 9 |
|
| 258. |
Which one of the following is false?(a) Heap sort is an in-place algorithm(b) Heap sort has O(nlogn) average case time complexity(c) Heap sort is stable sort(d) Heap sort is a comparison-based sorting algorithmThe question was posed to me during an interview.Question is from Heapsort in section Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (c) Heap sort is stable sort |
|
| 259. |
Heap sort is an implementation of ____________ using a descending priority queue.(a) insertion sort(b) selection sort(c) bubble sort(d) merge sortThe question was asked at a job interview.This question is from Heapsort in section Sorting of Data Structures & Algorithms II |
|
Answer» Right CHOICE is (b) selection sort |
|
| 260. |
What is the average number of comparisons used to heap sort a random permutation of N distinct items?(a) 2N log N-O(N)(b) 2N log N-O(N log N)(c) 2N log N-O(N log log N)(d) 2N log N-O(log N)I got this question in an interview for job.This question is from Heapsort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT answer is (c) 2N log N-O(N log log N) Explanation: According to a theorem, the average NUMBER of COMPARISONS used to heap sort a random PERMUTATION of N distinct items is found to be 2N log N-O(N log log N). |
|
| 261. |
What is the time taken to copy elements to and from two arrays created for deletion?(a) O(N)(b) O(N log N)(c) O(log N)(d) O(N^2)The question was posed to me in an international level competition.This intriguing question comes from Heapsort in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (a) O(N) |
|
| 262. |
What is the average number of comparisons used in a heap sort algorithm?(a) N log N-O(N)(b) O(N log N)-O(N)(c) O(N log N)-1(d) 2N log N + O(N)The question was posed to me during an interview.This is a very interesting question from Heapsort in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (d) 2N LOG N + O(N) |
|
| 263. |
Heap sort is an extremely stable algorithm.(a) true(b) falseThe question was posed to me in quiz.My enquiry is from Heapsort topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (a) true |
|
| 264. |
What is the time taken to perform a delete min operation?(a) O(N)(b) O(N log N)(c) O(log N)(d) O(N^2)This question was addressed to me in an online quiz.This is a very interesting question from Heapsort in division Sorting of Data Structures & Algorithms II |
|
Answer» Correct option is (C) O(log N) |
|
| 265. |
How many arrays are required to perform deletion operation in a heap?(a) 1(b) 2(c) 3(d) 4This question was posed to me in examination.Asked question is from Heapsort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT CHOICE is (b) 2 |
|
| 266. |
What is the typical running time of a heap sort algorithm?(a) O(N)(b) O(N log N)(c) O(log N)(d) O(N^2)This question was posed to me during an interview.Question is taken from Heapsort topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT answer is (b) O(N log N) |
|
| 267. |
In heap sort, after deleting the last minimum element, the array will contain elements in?(a) increasing sorting order(b) decreasing sorting order(c) tree inorder(d) tree preorderThis question was posed to me in exam.I would like to ask this question from Heapsort topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (b) decreasing SORTING order |
|
| 268. |
In what position does the array for heap sort contains data?(a) 0(b) 1(c) -1(d) anywhere in the arrayThis question was addressed to me in an online quiz.This question is from Heapsort in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (a) 0 |
|
| 269. |
Consider the following heap after buildheap phase. What will be its corresponding array?(a) 26,53,41,97,58,59,31(b) 26,31,41,53,58,59,97(c) 26,41,53,97,31,58,59(d) 97,53,59,26,41,58,31I got this question during a job interview.This key question is from Heapsort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT option is (d) 97,53,59,26,41,58,31 |
|
| 270. |
Heap sort is faster than Shell sort.(a) true(b) falseThe question was posed to me during an interview.Question is taken from Heapsort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct option is (B) false |
|
| 271. |
In what time can a binary heap be built?(a) O(N)(b) O(N log N)(c) O(log N)(d) O(N^2)I got this question in an interview.The doubt is from Heapsort in section Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT answer is (a) O(N) |
|
| 272. |
On which algorithm is heap sort based on?(a) Fibonacci heap(b) Binary tree(c) Priority queue(d) FIFOThis question was posed to me during an online interview.I'd like to ask this question from Heapsort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (C) Priority QUEUE |
|
| 273. |
Which of the following is true?(a) Shell sort’s passes completely sort the elements before going on to the next-smallest gap while Comb sort’s passes do not completely sort the elements(b) Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap like in Comb sort(c) Comb sort’s passes completely sort the elements before going on to the next-smallest gap like in Shell sort(d) Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap while Comb sort’s passes completely sort the elementsThis question was addressed to me in unit test.Origin of the question is Shell sort in division Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT CHOICE is (a) Shell sort’s passes completely sort the ELEMENTS before going on to the next-smallest gap while Comb sort’s passes do not completely sort the elements |
|
| 274. |
Shell sort is more efficient than insertion sort if the length of input arrays is small.(a) True(b) FalseI had been asked this question in homework.The question is from Shell sort topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (b) False |
|
| 275. |
Records R1, R2, R3,.. RNwith keys K1, K2, K3,.. KNare said to be h-ordered, if ________(a) Ki |
|
Answer» Correct option is (d) Ki <= Ki+hfor 1<= i <= N-h |
|
| 276. |
If Hibbard increments (h1= 1, h2= 3, h3= 7, …, hk = 2^k–1) are used in a Shell sort implementation, then the best case time complexity will be ________(a) O(nlogn)(b) O(n)(c) O(n^2)(d) O(logn)The question was asked in a national level competition.This interesting question is from Shell sort topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct CHOICE is (a) O(nlogn) |
|
| 277. |
An array that is first 7-sorted, then 5-sorted becomes _________(a) 7-ordered(b) 5-ordered(c) both 2-ordered and 5-ordered(d) both 7-ordered and 5-orderedThis question was addressed to me in an online quiz.My question is from Shell sort in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (d) both 7-ordered and 5-ordered |
|
| 278. |
Shell sort is an improvement on ____(a) insertion sort(b) selection sort(c) binary tree sort(d) quick sortThis question was posed to me in a job interview.Question is taken from Shell sort in section Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (a) insertion sort |
|
| 279. |
Shell sort is applied on the elements 27 59 49 37 15 90 81 39 and the chosen decreasing sequence of increments is (5,3,1). The result after the first iteration will be(a) 27 59 49 37 15 90 81 39(b) 27 59 37 49 15 90 81 39(c) 27 59 39 37 15 90 81 49(d) 15 59 49 37 27 90 81 39This question was posed to me during a job interview.The origin of the question is Shell sort in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right ANSWER is (c) 27 59 39 37 15 90 81 49 |
|
| 280. |
Statement 1: Shell sort is a stable sorting algorithm.Statement 2: Shell sort is an in-place sorting algorithm.(a) Both statements are true(b) Statement 2 is true but statement 1 is false(c) Statement 2 is false but statement 1 is true(d) Both statements are falseThe question was posed to me in unit test.This is a very interesting question from Shell sort in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (b) Statement 2 is true but statement 1 is false |
|
| 281. |
What is the worst case analysis of Shell sort using Sedgewick’s increments?(a) O(N^2)(b) O(N^3/2)(c) O(N^4/3)(d) O(N^5/4)This question was addressed to me in homework.Question is taken from Shell sort in portion Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT choice is (C) O(N^4/3) Explanation: The worst case analysis of Shell SORT using Sedgewick’s increments is mathematically calculated to be O(N^4/3). |
|
| 282. |
What is the worst case analysis of shell sort using Shell’s increments?(a) O(N)(b) O(N^2)(c) O(N^1/2)(d) O(N^3/2)I got this question in semester exam.This key question is from Shell sort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (b) O(N^2) |
|
| 283. |
What is the general form of Shell’s increments?(a) 1,2,3,…,n(b) 1,3,7,….,2k-1(c) 1,3,5,7,….,k-1(d) 1,5,10,15,…, k-1I have been asked this question by my college professor while I was bunking the class.Query is from Shell sort topic in division Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (b) 1,3,7,….,2k-1 |
|
| 284. |
What is the worst case running time of shell sort using Hibbard’s increments?(a) O(N)(b) O(N^2)(c) O(N^1/2)(d) O(N^3/2)The question was posed to me during an interview.Question is from Shell sort in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (d) O(N^3/2) |
|
| 285. |
On how many increment sequences does the worst case analysis of shell sort depends?(a) one(b) two(c) three(d) fourI have been asked this question in examination.I'd like to ask this question from Shell sort topic in section Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT choice is (C) three The explanation is: The WORST case analysis of shell sort depends on two increment sequences- using Shell’s increments, Sedgewick’s and HIBBARD’s increments. |
|
| 286. |
Why is Shell sort called as a generalization of Insertion sort?(a) Shell sort allows an exchange of far items whereas insertion sort moves elements by one position(b) Improved lower bound analysis(c) Insertion is more efficient than any other algorithms(d) Shell sort performs internal sortingThis question was addressed to me in an interview for internship.My doubt stems from Shell sort topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (a) SHELL sort ALLOWS an exchange of far items WHEREAS INSERTION sort moves elements by one position |
|
| 287. |
Which of the following sorting algorithms is closely related to shell sort?(a) Selection sort(b) Merge sort(c) Insertion sort(d) Bucket sortI have been asked this question during an interview for a job.I need to ask this question from Shell sort topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT CHOICE is (c) Insertion sort |
|
| 288. |
Shell sort uses a sequence called a incrementing sequence to sort the elements.(a) True(b) FalseI got this question by my college director while I was bunking the class.I'd like to ask this question from Shell sort in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct CHOICE is (a) True |
|
| 289. |
Shell sort algorithm is an example of?(a) External sorting(b) Internal sorting(c) In-place sorting(d) Bottom-up sortingI have been asked this question in semester exam.The doubt is from Shell sort in division Sorting of Data Structures & Algorithms II |
|
Answer» Right OPTION is (b) Internal sorting |
|
| 290. |
Shell sort algorithm is the first algorithm to break the quadratic time barrier.(a) True(b) FalseThe question was posed to me during an online exam.This interesting question is from Shell sort in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (a) True |
|
| 291. |
Who invented the shell sort algorithm?(a) John Von Neumann(b) Donald Shell(c) Tony Hoare(d) Alan ShellI had been asked this question in an online interview.This interesting question is from Shell sort in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (b) Donald Shell |
|
| 292. |
The worst case running time of shell sort, using Shell’s increments is?(a) O(N)(b) O(N log N)(c) O(log N)(d) O(N^2)I got this question by my school teacher while I was bunking the class.This interesting question is from Shell sort in portion Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT option is (d) O(N^2) The EXPLANATION is: The LOWER bound of a shell sort algorithm is mathematically found to be O(N^2). |
|
| 293. |
What is the other name for a shell sort algorithm?(a) Diminishing increment sort(b) Diminishing decrement sort(c) Insertion sort(d) Selection sortThe question was asked in an interview.Enquiry is from Shell sort in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (a) Diminishing increment sort |
|
| 294. |
Quick sort uses which of the following method to implement sorting?(a) merging(b) partitioning(c) selection(d) exchangingI have been asked this question during an interview.Enquiry is from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT answer is (b) PARTITIONING Explanation: Quick sort MAKES partitions of the input array about the pivot in order to IMPLEMENT sorting. Thus its METHOD of sorting is called partitioning. |
|
| 295. |
What is the average time complexity of the median of three quick sort?(a) O(n log n)(b) O(n^2)(c) O(n^2 log n)(d) O(n log n^2)I have been asked this question by my college professor while I was bunking the class.The above asked question is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (a) O(n LOG n) |
|
| 296. |
What is the auxiliary space complexity of a median of three quick sort?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)I got this question in homework.Question is from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT option is (c) O(log n) |
|
| 297. |
What is the purpose of using a median of three 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 complexityI have been asked this question in an interview.This is a very interesting question from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT option is (a) so as to avoid worst case time complexity The BEST I can explain: Median of THREE quick sort helps in avoiding the worst case time complexity of O(n^2) which occurs in case when the input array is already sorted. However, the AVERAGE case and best case time complexities remain UNALTERED. |
|
| 298. |
What is the median of three techniques in quick sort?(a) quick sort with random partitions(b) quick sort with random choice of pivot(c) choosing median element as pivot(d) choosing median of first, last and middle element as pivotThe question was asked at a job interview.The query is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (d) choosing median of FIRST, last and middle element as pivot |
|
| 299. |
Quick sort uses which of the following algorithm to implement sorting?(a) backtracking(b) greedy algorithm(c) divide and conquer(d) dynamic programmingI had been asked this question in examination.My question is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT option is (C) divide and CONQUER |
|
| 300. |
Randomized quick sort is an in place sort.(a) true(b) falseI have been asked this question during an interview.My question is taken from Sorting in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (a) true |
|