0% found this document useful (0 votes)
56 views9 pages

JSPM'S Jayawantrao Sawant College of Engineeringhadpsar, Pune-33 Department of Information Technology Multiple Choice Questions Unit-4

The document discusses multiple choice questions about sorting algorithms and their time complexities. It includes questions about linear search, binary search, bubble sort, insertion sort, selection sort, quick sort, and merge sort. Key details assessed include the time complexities of different sorting algorithms, how they work, their advantages and disadvantages, and sorting related terms.

Uploaded by

Father
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views9 pages

JSPM'S Jayawantrao Sawant College of Engineeringhadpsar, Pune-33 Department of Information Technology Multiple Choice Questions Unit-4

The document discusses multiple choice questions about sorting algorithms and their time complexities. It includes questions about linear search, binary search, bubble sort, insertion sort, selection sort, quick sort, and merge sort. Key details assessed include the time complexities of different sorting algorithms, how they work, their advantages and disadvantages, and sorting related terms.

Uploaded by

Father
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

JSPM's

Jayawantrao sawant College of EngineeringHadpsar, Pune-33


Department of Information Technology
Multiple Choice Questions

Unit-4

1.Which of the following best describes sorting ?


A.Accessing and processing each record exactly once
B.Finding the location of the record with a given key
C.Arranging the data (record) in some given order
D.Adding a new record to the data structure
ANSWER: C

2.The time complexity of linear search algorithm over an array of n elements is


A.O (log2 n)
B.O(n)
C.O(n log2 n)
D.0 (n2)
ANSWER: B

3.A characteristic of the data that binary search uses but the linear search ignores is
the___________
A.Order of the elements of the list
B.Length of the list
C.Maximum value in list
D.Type of elements of the list
ANSWER: A

4.The data for which you are searching is called


A.search argument
B.sorting argument
C.detection argument
D.binary argument
ANSWER: A

5.For a linear search in an array of n elements the time complexity for best, worst and average
case are ......., ....... and ........ respectively
A.O(n), O(1), and O(n/2)
B.O(1), O(n) and O(n/2)
C.O(1),O(n) and O(n)
D.O(1), O(n) and (n-1/2)
ANSWER: C
6.Which of the following is false ?
A.A serial search begins with the first array element
B.A serial search continues searching, element by element, either until a match is found or until
the end of the array is encountered
C.A serial search is useful when the amount of data that must be search is small
D.For a serial search to work, the data in the array must be arranged in either alphabetical or
numerical order
ANSWER: D

7.The average successful search time for sequential search on 'n' items is
A.n/2
B.(n-1)/2
C.(n+1)/2
D.log (n)+1
ANSWER: C

8.A search begins the search with the element that is located in the middle of the array
A.serial
B.random
C.parallel
D.binary
ANSWER: D

9.Suppose DATA array contains 1000000 elements. Using the binary search algorithm, one
requires only about n comparisons to find the location of an item in the DATA array, then n is
A.60
B.45
C.20
D.None of these
ANSWER: C

10.Which of the following is false ?


A.A binary search begins with the middle element in the array
B.A binary search continues having the array either until a match is found or until there are no
more elements to search
C.If the search argument is greater than the value located in the middle of the binary, the binary
search continues in the upper half of the array
D.For a binary search to work, the data in the array must be arranged in either alphabetical or
numerical order
ANSWER: C

11.The order of the binary search algorithm is


A.n
B.n2
C.nlog(n)
D.log(n)
ANSWER: Option D

12.Sorting is useful for


A.report generation
B.respondingtoe queries easily
C.making searching easier and efficient
D.All of these
ANSWER: D

13.Choose the correct statements


A.Internal sorting is used if the number of items to be sorted is very large.
B.External sorting is used if the number of items to be sorted is very large
C.External sorting needs auxilary storage
D.Both (b) & (c)
ANSWER: D

14.A sort which compares adjacent elements in a list and switches where necessary is
A.insertion sort
B.heap sort
C.quick sort
D.bubble sort
ANSWER: D

15.Which of the following sorting methods would be most suitable for sorting a list which is
almost sorted
A.Bubble Sort
B.Insertion Sort
C.Selection Sort
C.Quick Sort
ANSWER: A

16.Which of the following sorting procedure is the slowest ?


A.Quick sort
B.Heap sort
C.Shell sort
D.Bubble sort
ANSWER: D

17.The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending
order, using bubble sort is
A.11
B.12
C.13
D.14
ANSWER: D

18.A machine took 200 sec to sort 200 names, using bubble sort. In 800 sec, it can approximately
sort
A.400 names
B.800 names
C.750 names
D.800 names
ANSWER: A

19.Given a file of size n the number of times a given file is passed through in bubble sort is
A.n2
B.n - 1
C.n log n
ANSWER: B

20.In bubble sort, for a file of size n, after p iterations number of records in proper positions is
A.n - p
B.n - p + 1
C.p
ANSWER: A

21.A sort which iteratively passes through a list to exchange the first element with any element
less than it and then repeats with a new first element is called
A.insertion sort
B.selection sort
C.heap sort
D.quick sort
ANSWER: B

22.Which of the following sorting methods will be the best if number of swappings done, is the
only measure of efficienty?
A.Bubble sort
B.Selection sort
C.Insertion sort
D.Quick sort
ANSWER: B
23.What is the number of swaps required to sort n elements using selection sort, in the worst
case?
A.T(n)
B.T(n log n)
C.T(n2)
D.T(n2 log n)
ANSWER: A

24.Staright selection sort is basically a method of repeated


A.interchange
B.searching
C.position adjustment
ANSWER: C

25.Number of selections required to sort a file of size N by straight selection requires


a.N - 1
b.log N
c.O(N2)
ANSWER: A

26.For sorting a file of size n by straight selection sort, the number of comparisons made in the
first pass is
a.n
b.n - 1
c.n(n - 1)/2
ANSWER: B

27.Which of the following sorting method is stable ?


A.insertion sort
B.Quick sort
C.Shell sort
D.Heap sort
ANSWER: A

28.You have to sort a list L consisting of a sorted list followed by a few “random”
elements.Which of the following sorting methods would be especially suitable for such a task?
A.Bubble sort
B.Selection sort
C.Quick sort
D.Insertion sort
Ans:D
29.Which of the following sorting methods would be most suitable for sorting a list which is
already sorted
A.Bubble Sort
B.Insertion Sort
C.Selection Sort
C.Quick Sort
ANSWER: B

30.The way a card game player arranges his cards as he picks them up one by one, is an example
of
A.bubble sort
B.Selection sort
C.insertion sort
D.merge sort
ANSWER: C

31.You want to check whether a given set of items is sorted. Which of the following sorting
methods will be most efficient if it is already in sorted order?
A.Bubble sort
B.Selection sort
C.Insertion sort
D.Merge Sort
ANSWER: C

32.Which of the following sorting algorithms does not have a worst case running time of O(n2)?
A.Insertion sort
B.Merge sort
C.Quick sort
D.Bubble sort
ANSWER: B

33.Merge sort uses


A.divide and conquer strategy
B.backtracking approach
C.heuristic search
D.greedy approach
ANSWER: A

34.Assume 5 buffer pages are available to sort a file of 105 pages. The cost of sorting using m-
way merge sort is
A.206
B.618
C.840
D.926
ANSWER: C

35.A desirable choice for the partitioning element in quick sort is


A.First element of the list
B.Last element of the list
C.Randomly chosen element of the list
D.Median of the list
Answer: A

36.Quick sort is also known as


A.Merge sort
B.Heap sort
C.Bubble sort
C.None of these
ANSWER: D

37.A sort which relatively passes through a list to exchange the first element with any element
less than it and then repeats with a new first element is called
A.Insertion sort
B.Selection sort
C.Heap sort
D.Quick sort
ANSWER: D

39.The best average behaviour is shown by


38.A.Quick Sort
B.Merge Sort
C.Insertion Sort
C.Heap Sort
ANSWER: A

40.Which of the following sorting methods sorts a given set of items that is already in sorted
order or in reverse sorted order with equal speed?
A.Heap sort
B.Quick sort
C.Insertion sort
D.Selection sort
ANSWER: B

41.A machine needs a minimum of 100 sec to sort 1000 names by quick sort. The minimum time
needed to sort 100 names will be approximately
A.50.2 sec
B.6.7 sec
C.72.7 sec
D.11.2 sec
ANSWER: B

42.Which of the following is useful in implementing quick sort?


A.Stack
B.Set
C.List
D.Queue
ANSWER: A

43.In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an
T(n) time algorithm. What is the worst case time complexity of the quick sort?
A.T(n)
B.T(n log n)
C.T(n2)
D.T(n2 log n)
ANSWER: B

44.The running time of the following sorting algorithm depends on whether the partitioning is
balanced or unbalanced
A.Insertion sort
B.Selection sort
C.Quick sort
D.Merge sort
ANSWER: C

45.In worst case Quick Sort has order


A.O (n log n)
B.O (n^2/2)
C.O (log n)
D.O (n2/4)
ANSWER: B

46.In quick sort, the number of partitions into which the file of size n is divided by a selected
record is
A.n
B.n - 1
C.2
ANSWER: C

47.The total number of comparisons made in quick sort for sorting a file of size n, is
a.O(n log n)
b.O(n2)
c.n(log n)
ANSWER: A

48.Quick sort efficiency can be improved by adopting


a.non-recursive method
b.insertion method
c.tree search method
ANSWER: A

49.For the improvement of efficiency of quick sort the pivot can be


a.the first element
b.the mean element
c.the last element
ANSWER: B

50.Quick sort is the fastest available method of sorting because of


a.low over head
b.O(n log n) comparisons
c.lowover head and also O(n log n) comparisons
ANSWER: C

51.A sorting technique that guarantees that records with the same primary key occurs in the same
order in the sorted list as in the original unsorted list is said to be
A.stable
B.consistent
C.External
D.linear
ANSWER: A

You might also like