Explore topic-wise InterviewSolutions in .

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.

51.

The operation of processing each element in the list is known as _________(a) Sorting(b) Merging(c) Inserting(d) TraversalThis question was posed to me during an interview.This key question is from Algorithms in section Algorithms of Discrete Mathematics

Answer»

The correct answer is (d) TRAVERSAL

To EXPLAIN: The operation of PROCESSING each element in the list is KNOWN as Traversal.

52.

List obtained in third pass of selection sort for list 3, 5, 4, 1, 2 is ___________(a) 1, 2, 4, 3, 5(b) 1, 2, 3, 4, 5(c) 1, 5, 4, 3, 2(d) 3, 5, 4, 1, 2This question was posed to me in an internship interview.Asked question is from Algorithms topic in division Algorithms of Discrete Mathematics

Answer»

Correct CHOICE is (B) 1, 2, 3, 4, 5

To explain: The selection sort BEGINS with finding the least element in the list. This element is moved to FRONT and then the least element among the remaining elements. Is found and put into the second position and so on.

53.

The Worst case occurs in linear search algorithm when ____________(a) Item is somewhere in the middle of the array(b) Item is not in the array at all(c) Item is the last element in the array(d) Item is the last element in the array or is not there at allThis question was addressed to me during an internship interview.My question is taken from Algorithms topic in portion Algorithms of Discrete Mathematics

Answer»

Right answer is (d) Item is the last element in the array or is not there at all

The best I can EXPLAIN: The WORST case OCCUR in LINEAR SEARCH algorithm when Item is the last element in the array or is not there at all.

54.

__________ comparisons required to sort the list 1, 2, 3…….n using insertion sort.(a) (n^2 + n + 2) / 2(b) (n^3 + n – 2) / 2(c) (n^2 + n – 2) / 2(d) (n^2 – n – 2) / 2This question was posed to me in an internship interview.The doubt is from Algorithms topic in portion Algorithms of Discrete Mathematics

Answer»

Right option is (c) (n^2 + n – 2) / 2

To explain I WOULD SAY: 2+3+4+….6n = (n^2 + n – 2) / 2.

55.

If the entire list is searched sequentially without locating x in linear search, the solution is __________(a) 0(b) -1(c) 1(d) 2I have been asked this question in an international level competition.My question is from Algorithms in portion Algorithms of Discrete Mathematics

Answer»

The correct CHOICE is (a) 0

The best EXPLANATION: If the ELEMENT is not FOUND in the entire list, then the SOLUTION is 0.

56.

To sort a list with n elements, the insertion sort begins with the __________ element.(a) First(b) Second(c) Third(d) FourthThis question was addressed to me during an online exam.I'm obligated to ask this question of Algorithms topic in division Algorithms of Discrete Mathematics

Answer»

The correct answer is (b) Second

The BEST I can explain: The INSERTION sort COMPARES the second element with the first element to START SORTING.

57.

In ________ search each element is compared with x till not found.(a) Binary(b) Sequential(c) Merge(d) None of the mentionedThe question was asked during an interview.I would like to ask this question from Algorithms in section Algorithms of Discrete Mathematics

Answer» CORRECT answer is (b) Sequential

For explanation I WOULD say: In linear or sequential search entire LIST is searched sequentially for x.
58.

Out of the following which property algorithms does not share?(a) Input(b) Finiteness(c) Generality(d) ConstancyThis question was posed to me in semester exam.My enquiry is from Algorithms in section Algorithms of Discrete Mathematics

Answer»

Right CHOICE is (d) Constancy

Easy EXPLANATION: All the OTHERS are the PROPERTIES of ALGORITHMS.

59.

An algorithm is a _________ set of precise instructions for performing computation.(a) Infinite(b) Finite(c) Constant(d) None of the mentionedThis question was posed to me during an interview for a job.Question is taken from Algorithms topic in section Algorithms of Discrete Mathematics

Answer»

The CORRECT ANSWER is (b) Finite

The EXPLANATION is: By the definition of an algorithm.