0% found this document useful (0 votes)
224 views17 pages

Search Sort MCQ Gate

The document contains 30 multiple choice questions related to sorting and searching algorithms in computer science. Some key questions asked about the time complexity of insertion sort, quicksort, and mergesort. It also asked about stable vs unstable sorting algorithms, divide and conquer algorithms, and the differences between linear search, binary search, and hashing for search efficiency.

Uploaded by

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

Search Sort MCQ Gate

The document contains 30 multiple choice questions related to sorting and searching algorithms in computer science. Some key questions asked about the time complexity of insertion sort, quicksort, and mergesort. It also asked about stable vs unstable sorting algorithms, divide and conquer algorithms, and the differences between linear search, binary search, and hashing for search efficiency.

Uploaded by

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

adplus-dvertising

computer science objective type questions pdf computer science multiple choice questions with
answers pdf

mcq in computer science pdf multiple choice questions in computer science pdf download computer
science multiple choice questions with answers doc computer science quiz questions with answers pdf
computer basics mcq pdf

computer science objective questions for competitive exams

mcqs in computer science pdf free download

Toggle navigation

HOME / ALL CATEGORIES / DATA STRUCTURES AND ALGORITHMS / SORTING AND SEARCHING /

1.

What is not true about insertion sort?

a.

Exhibits the worst case performance when the initial array is sorted in reverse order.

b.

Worst case and average case performance is Ο(n2)

c.

Can be compared to the way a card player arranges his card from a card deck.

d.

None of the above.

Answer: (d).

None of the above.

2.

Which of the following has search efficiency of Ο(1) −


a.

Tree

b.

Heap

c.

Hash Table

d.

Linked-List

Answer: (c).

Hash Table

3.

Which of the following algorithm is not stable?

a.

Bubble Sort

b.

Quick Sort

c.

Merge Sort

d.

Insertion Sort

Answer: (b).

Quick Sort
4.

Which of the below mentioned sorting algorithms are not stable?

a.

Selection Sort

b.

Bubble Sort

c.

Merge Sort

d.

Insertion Sort

Answer: (a).

Selection Sort

5.

A pivot element to partition unsorted list is used in

a.

Merge Sort

b.

Quick Sort

c.

Insertion Sort

d.

Selection Sort
Answer: (b).

Quick Sort

6.

Which of the following algorithm does not divide the list −

a.

linear search

b.

binary search

c.

merge sort

d.

quick sort

Answer: (a).

linear search

7.

Time required to merge two sorted lists of size m and n, is

a.

Ο(m | n)

b.

Ο(m + n)

c.

Ο(m log n)

d.

Ο(n log m)
Answer: (b).

Ο(m + n)

8.

Quick sort algorithm is an example of

a.

Greedy approach

b.

Improved binary search

c.

Dynamic Programming

d.

Divide and conquer

Answer: (d).

Divide and conquer

9.

Quick sort running time depends on the selection of

a.

size of array

b.

pivot element

c.

sequence of values
d.

none of the above

Answer: (b).

pivot element

10.

Which one of the below is not divide and conquer approach?

a.

Insertion Sort

b.

Merge Sort

c.

Shell Sort

d.

Heap Sort

Answer: (b).

Merge Sort

11.

Which of the following searching techniques do not require the data to be in sorted form

a.

Binary Search

b.

Interpolation Search

c.
Linear Search

d.

All of the above

Answer: (c).

Linear Search

12.

Which of the below given sorting techniques has highest best-case runtime complexity

a.

quick sort

b.

selection sort

c.

insertion sort

d.

bubble sort

Answer: (b).

selection sort

13.

How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4} ?

a.

b.
5

c.

d.

Answer: (a).

14.

An adaptive sorting algorithm −

a.

adapts to new computers.

b.

takes advantage of already sorted elements.

c.

takes input which is already sorted.

d.

none of the above.

Answer: (b).

takes advantage of already sorted elements.

15.

The following sorting algorithms maintain two sub-lists, one sorted and one to be sorted −

a.

Selection Sort
b.

Insertion Sort

c.

Merge Sort

d.

both A & B

Answer: (d).

both A & B

16.

The worst case complexity of binary search matches with −

a.

interpolation search

b.

linear search

c.

merge sort

d.

none of the above

Answer: (b).

linear search

17.

The number of comparisons done by sequential search is ………………


a.

(N/2)+1

b.

(N+1)/2

c.

(N-1)/2

d.

(N+2)/2

Answer: (b).

(N+1)/2

18.

In ……………, search start at the beginning of the list and check every element in the list.

a.

Linear search

b.

Binary search

c.

Hash Search

d.

Binary Tree search

Answer: (a).

Linear search
19.

State True or False.

i) Binary search is used for searching in a sorted array.

ii) The time complexity of binary search is O(logn).

a.

True, False

b.

False, True

c.

False, False

d.

True, True

Answer: (d).

True, True

20.

Which of the following is not the internal sort?

a.

Insertion Sort

b.

Bubble Sort

c.

Merge Sort
d.

Heap Sort

Answer: (c).

Merge Sort

21.

In general, the binary search method needs no more than ……………. comparisons.

a.

[log2n]-1

b.

[logn]+1

c.

[log2n]

d.

[log2n]+1

Answer: (d).

[log2n]+1

22.

The Worst case occur 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 all

Answer: (d).

Item is the last element in the array or is not there at all

23.

The Average case occur in linear search algorithm

a.

When Item is somewhere in the middle of the array

b.

When Item is not in the array at all

c.

When Item is the last element in the array

d.

When Item is the last element in the array or is not there at all

Answer: (a).

When Item is somewhere in the middle of the array

24.

Which of the following is not the required condition for binary search algorithm?

a.

The list must be sorted

b.
there should be the direct access to the middle element in any sublist

c.

There must be mechanism to delete and/or insert elements in list

d.

none of above

Answer: (c).

There must be mechanism to delete and/or insert elements in list

25.

Which of the following is not a limitation of binary search algorithm?

a.

must use a sorted array

b.

requirement of sorted array is expensive when a lot of insertion and deletions are needed

c.

there must be a mechanism to access middle element directly

d.

binary search algorithm is not efficient when the data elements are more than 1000

Answer: (d).

binary search algorithm is not efficient when the data elements are more than 1000

26.

Binary search algorithm can not be applied to

a.
sorted linked list

b.

sorted binary trees

c.

sorted linear array

d.

pointer array

Answer: (a).

sorted linked list

27.

If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected
number of collisions involving a particular key x is :

a.

less than 1

b.

less than n

c.

less than m

d.

less than n/2

Answer: (a).

less than 1

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

Answer: (d).

Insertion sort

29.

A technique for direct search is

a.

Binary Search

b.

Linear Search

c.

Tree Search

d.

Hashing

30.
The searching technique that takes O (1) time to find a data is

a.

Linear Search

b.

Binary Search

c.

Hashing

d.

Tree Search

Answer: (c).

Hashing

You might also like