Data Structures and Algorithms MCQ Questions Set 02

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 41

Data Structures And Algorithms MCQ

Questions
Set 02
1. Each data item in a record may be a group item composed of sub-items; those items which
are indecomposable are called

a. elementary items

b. atoms

c. scalars

d. all of above

2. Which of the following is two way list?

a. grounded header list

b. circular header list

c. linked list with header and trailer nodes

d. none of above

3. Which of the following statement is false?

a. Arrays are dense lists and static data structure

b. data elements in linked list need not be stored in adjacent space in memory

c. pointers store the next data element of a list

d. linked lists are collection of the nodes that contain information part and next pointer

4. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would


return

a. FAEKCDBHG

b. FAEKCDHGB
c. EAFKHDCBG

d. FEAKDCHBG

5. The memory address of the first  element  of an array is called

a. floor address

b. foundation address

c. first address

d. base address

6. The difference between linear array and a record is

a. An array is suitable for homogeneous data but the data items in a record may have different
data type

b. In a record, there may not be a natural ordering in opposed to linear array.

c. A record form a hierarchical structure but a linear array does not

d. All of above

7. Which of the following name does not relate to stacks?

a. FIFO lists

b. LIFO list

c. Piles

d. Push-down lists

8. Which of the following data structures are indexed structures?

a. linear arrays

b. linked lists

c. both of above

d. none of above

9. The term “push” and “pop” is related to the


a. array

b. lists

c. stacks

d. all of above

10. The memory address of fifth element of an array can be calculated by the formula

a. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory


cell for the array

b. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per


memory cell for the array

c. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per


memory cell for the array

d. None of above

11. Two dimensional arrays are also called

a. tables arrays

b. matrix arrays

c. both of above

d. none of above

12. When new data are to be inserted into a data structure, but there is no available space; this
situation is usually called

a. underflow

b. overflow

c. housefull

d. saturated

13. The situation when in a linked list START=NULL is

a. underflow
b. overflow

c. housefull

d. saturated

14. A variable P is called pointer if

a. P contains the address of an element in DATA.

b. P points to the address of first element in DATA

c. P can store only memory addresses

d. P contain the DATA and the address of DATA

15. Which of the following data structure can’t store the non-homogeneous data elements?

a. Arrays

b. Records

c. Pointers

d. None

16. Which of the following data structure store the homogeneous data elements?

a. Arrays

b. Records

c. Pointers

d. None

17. 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.
18. Binary search algorithm can not be applied to

a. sorted linked list

b. sorted binary trees

c. sorted linear array

d. pointer array

19. A data structure where elements can be added or removed at either end but not in the
middle

a. Linked lists

b. Stacks

c. Queues

d. Deque

20. 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

Correct Answers to Data Structures And


Algorithms MCQs
1- d 2- d 3- c 4- b 5- b 6- d 7- a 8- a 9- c
11- c 12- b 13- a 14- a 15- a 16- a 17- d 18- a 19- d
 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.

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google


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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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
View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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)

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Merge Sort

  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /


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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).selection sort

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

a. 4

b. 5

c. 6

d. 7

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).4
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.

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google


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

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).

  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /

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

a. [log2n]-1

b. [logn]+1

c. [log2n]

d. [log2n]+1

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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

View Answer Report Discuss Too Difficult! Search Google

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 numb
:

a. less than 1

b. less than n

c. less than m

d. less than n/2

View Answer Report Discuss Too Difficult! Search Google

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
suitable for such a task?

a. Bubble sort

b. Selection sort

c. Quick sort

d. Insertion sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).Insertion sort

29. A technique for direct search is

a. Binary Search

b. Linear Search

c. Tree Search

d. Hashing

View Answer Report Discuss Too Difficult! Search Google

Answer: (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

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Hashing
 DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /

31. The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is

a. 6

b. 5

c. 7

d. 8

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).5

32. In worst case Quick Sort has order

a. O (n log n)

b. O (n^2 /2)

c. O (log n)

d. O (n^2 /4)

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).O (n^2 /2)

33. A sort which relatively passes through a list to exchange the first element with any element less than it and the

a. insertion sort

b. selection sort

c. heap sort
d. quick sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).quick sort

34. Which of the following sorting algorithms does not have a worst case running time of O (n^2) ?

a. Insertion sort

b. Merge sort

c. Quick sort

d. Bubble sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Merge sort

35. The quick sort algorithm exploit _________ design technique.

a. Greedy

b. Dynamic programming

c. Divide and Conquer

d. Backtracking

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Divide and Conquer

36. The total number of companions required to merge 4 sorted files containing 15, 3, 9 and 8 records into a singl

a. 66

b. 39
c. 33

d. 15

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).33

37. The complexity of searching an element from a set of n elements using Binary search algorithm is

a. O(n)

b. O(log n)

c. O(n^2)

d. O(n log n)

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).O(log n)

38. 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

d. Quick Sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Bubble Sort

39. Quick sort is also known as

a. merge sort
b. heap sort

c. bubble sort

d. none of these

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).none of these

40. The goal of hashing is to produce a search that takes

a. O(1) time

b. O(n^2 ) time

c. O(log n ) time

d. O(n log n ) time

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).O(1) time

  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /

41. The best average behaviour is shown by

a. Quick Sort

b. Merge Sort

c. Insertion Sort

d. Heap Sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Quick Sort
42. Consider that n elements are to be sorted. What is the worst case time complexity of Bubble sort?

a. O(1)

b. O(logn)

c. O(n)

d. O(n^2)

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).O(n^2)

43. 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.

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Order of the elements of the list.

44. Which of the following sorting algorithm is stable ?

a. insertion sort

b. bubble sort

c. quick sort

d. heap sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).heap sort
45. In binary search, average number of comparison required for searching an element in a list if n numbers is

a. log2 n

b. n /2

c. n

d. n-1

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).log2 n

46. The worst case of quick sort has order

a. O(n^2 )

b. O(n)

c. O (n log2 n)

d. O (log2 n)

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).O(n^2 )

47. Which technique is suitable for performing a search in a small array or in an unsorted array?

a. Binary search

b. Traversing

c. Linear search

d. Sums

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Linear search
48. What finds the largest element in the array, and puts it in the proper place?

a. Selection sort

b. Insertion sort

c. Quick sort

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Selection sort

49. Which array is the fastest on an average, but sometimes unbalanced partitions can lead to very slow sorting?

a. Insertion sort

b. Selection sort

c. Quick sort

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Quick sort

50. In computer science, what is of immense importance and is one of the most extensively researched subjects?

a. Sorting

b. Searching

c. Both (a) and (b)

d. Inflecting

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Both (a) and (b


  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /

51. It is estimated that around __________ of all CPU cycles are used to sort data?

a. 10 per cent

b. 50 per cent

c. 30 per cent

d. 25 per cent

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).25 per cent

52. In which field, a sorting algorithm refers to an algorithm the function of which is to put elements of a list in a ce

a. Computer science

b. Mathematics

c. Both (a) and (b)

d. Data structures

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Both (a) and (b)

53. Which of the following statements is correct?

(i) Sorting is also often used to produce human-readable output.


(ii) The output should not be a permutation or reordering of the input.

a. (ii) only
b. (i) only

c. Both are correct

d. None is correct

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).(i) only

54. The analysis of bubble sort was done as early as_____________.

a. 1956

b. 1946

c. 1916

d. 1936

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).1956

55. ___________ is a method of arranging keys in a file in the ascending or descending order.

a. Lexicographical orders

b. Library sort

c. Algorithm

d. Sorting

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).Sorting

56. Library sort was first published in___________.


a. 2004

b. 2001

c. 2008

d. 1998

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).2004

57. Sorting makes handling of ______ in a file easier.

a. Records

b. Arrays

c. Information

d. Data

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Records

58. What refers to a simple sorting algorithm?

a. Bubble sort

b. Insertion sort

c. Unsorted arrays

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Insertion sort
59. _________is efficient for data sets which are already substantially sorted. The time complexity is O(n + d), wh

a. Insertion sort

b. Sorted array

c. Unsorted array

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Insertion sort

60. Compared to insertion sort, _________ are more advanced algorithms.

a. Quick sort

b. Heap sort

c. Merge sort

d. All of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).All of the above

  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /

61. In abstract terms, each iteration of insertion sort removes an element from the input data and
then inserts it into the correct position in the _________ that is already sorted.

a. List

b. Stack

c. String
d. Array

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).List

62. An array sorted in the reverse order is the __________ case input.

a. Worst

b. Best

c. Somewhat bad

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Worst

63. ___________ is a simple sorting technique to sort a list of elements.

a. Insertion sort

b. Selection sort

c. Sorting array

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Selection sort

64. The running time of heap sort is __________.

a. G(N*lgN)

b. N(N*lgN)
c. O(N*lgN)

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).O(N*lgN)

65. There is one to one correspondence between elements of the _________of the tree.

a. Array and trees

b. Array and nodes

c. Arrays and nodes

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Array and nodes

66. To perform the heap sort, you need to create a tree with all nodes greater than their __________.

a. Sibling

b. Children

c. Parents

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Children

67. What is one of the fastest and simplest sorting algorithms?

a. Selection sort
b. Tree sort

c. Heap sort

d. Quick sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).Quick sort

68. The most-used orders are___________.

a. Numerical order

b. Lexicographical order

c. Both (a) and (b)

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Lexicographical order

69. __________ refers to the set of all possible solutions to a problem.

a. External searching

b. Brute-force search

c. Search space

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Search space

70. Brute-force search, commonly known as_________.


a. Naive algorithm

b. Uninformed algorithm

c. Both (a) and (b)

d. Search algorithm

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Both (a) and (b)

  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /

71. Searching refers to an operation of finding the location of an item in a_______.

a. Table

b. File

c. Both (a) and (b)

d. Column

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Both (a) and (b)

72. When the records are stored in __________ or any secondary storage, then the searching is known as extern

a. Disk

b. Files

c. Tape

d. All of the above

View Answer Report Discuss Too Difficult! Search Google


Answer: (d).All of the above

73. Which is the easiest and least efficient searching technique?

a. Fibonacci search

b. Binary search

c. Linear search

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Linear search

74. The average searching time for Fibonacci search is__________.

a. N(log N)

b. S(log N)

c. O(log N)

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).O(log N)

75. Fibonaccian search, also referred to as Fibonacci search, is a ________algorithm for searching a sorted array
progressively smaller intervals.

a. Divide-and-rule

b. Divide-and-conquer

c. Divide-and-fall

d. None of the above


View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Divide-and-conquer

76. At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary sea

a. 10

b. 15

c. 20

d. 30

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).10

77. Which of the following is an example of in-place algorithm?

a. Bubble Sort

b. Merge Sort

c. Insertion Sort

d. None of the above

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Merge Sort

78. The average case of quick sort has order

a. O(n^2)

b. O(n)

c. O(n log n)
d. O(log n)

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).O(n log n)

79. Which sorting algorithm is the best if the list is already in order?

a. Quick sort

b. Merge sort

c. Insertion sort

d. None of these

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Insertion sort

80. The number of comparisons required to sort 5 numbers in ascending order using bubble sort is

a. 7

b. 6

c. 10

d. 5

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).10

  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /


81. The second largest number from a set of n distinct numbers can be found in

a. O(n)

b. O(2n)

c. O(n^2)

d. O(log n)

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).O(n)

82. The sort which inserts each elements A(K) into proper position in the previously sorted sub array A(1), ..., A(K

a. Insertion sort

b. Radix sort

c. Merge sort

d. Bubble sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Insertion sort

83. Shell sort uses ................

a. insertion sort

b. merge sort

c. selection sort

d. quick sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).insertion sort
84. 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

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).First element of the list

85. Out of the following, the slowest sorting procedure is

a. Quick Sort

b. Heap Sort

c. Shell Sort

d. Bubble Sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).Bubble Sort

86. The minimum number of comparisons required to find the largest number from 4 different numbers are

a. 4

b. 3

c. 5

d. 6

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).3
87. A sorting algorithm is stable if

a. its time complexity is constant irrespective of the nature of input

b. preserves the original order of records with equal keys

c. its space complexity is constant irrespective of the nature of input

d. it sorts any volume of data in a constant time

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).preserves the original order of records with equal keys

88. For a binary search algorithm to work, it is necessary that the array must be ............

a. sorted

b. unsorted

c. in a heap

d. popped out of stack

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).sorted

89. Match the following:

List - I
i. Bubble Sort  
ii. Shell Sort     
iii. Selection Sort   
     
List - II
a. Ο(n)
b. Ο(n2)
c. Ο(n log n)

a. i → a,  ii → b,  iii → c

b. i → b,  ii → c,  iii → a


c. i → a,  ii → c,  iii → b

d. i → b,  ii → a,  iii → c

View Answer Report Discuss Too Difficult! Search Google

Answer: (b). i → b,  ii → c,  iii → a

90. The largest and the second largest number from a set of n distinct numbers can be found in

a. O(n)

b. O(2n)

c. O(n^2)

d. O(log n)

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).O(n)

  DATA STRUCTURES AND ALGORITHMS /

  SORTING AND SEARCHING /

91. Hashing collision resolution techniques are:

a. Huffman coding, linear hashing

b. Bucket addressing, Huffman coding

c. Chaining, Huffman coding

d. Chaining, Bucket addressing

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).Chaining, Bucket addressing


92. After each iteration in bubble sort:

a. at least one element is at its sorted position

b. one less comparison is made in the next iteration

c. Both a & b are true

d. Neither a nor b is true

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).at least one element is at its sorted position

93. The running time of the following sorting algorithm depends on whether the partitioning is balanced or unbalan

a. Insertion sort

b. Selection sort

c. Quick sort

d. Merge sort

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).Quick sort

94. The average case complexity of Insertion Sort is

a. O(2^n)

b. O(n^3)

c. O(n^2)

d. O(2n)

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).O(n^2)
95. Linear search is highly inefficient compared to binary search when dealing with:

a. Small, unsorted arrays

b. Small, sorted arrays

c. Large, unsorted arrays

d. Large, sorted arrays

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).Large, sorted arrays

96. A sorted file contains 16 items. Using binary search, the maximum number of comparisons to search for an ite

a. 15

b. 8

c. 1

d. 4

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).4

97. The average number of key comparisons done in successful sequential search in a list of length n is ..............

a. log n

b. (n-1)/2

c. n/2

d. (n+1)/2

View Answer Report Discuss Too Difficult! Search Google

Answer: (d).(n+1)/2
98. The sorting technique where array to be sorted is partitioned again and again in such a way that all elements l
appear before it and those which are greater appear after it, is called ..............

a. Merge sort

b. Quick sort

c. Selection sort

d. None of these

View Answer Report Discuss Too Difficult! Search Google

Answer: (b).Quick sort

99. The search technique for searching a sorted file that requires increased amount of space is ................

a. Indexed sequential search

b. Interpolation search

c. Sequential search

d. Tree search

View Answer Report Discuss Too Difficult! Search Google

Answer: (a).Indexed sequential search

100
For merging two sorted lists of sizes m and n into a sorted list of size m + n, we require comparisons of
.

a. O(m)

b. O(n)

c. O(m+n)

d. O(log(m) + log(n))

View Answer Report Discuss Too Difficult! Search Google

Answer: (c).O(m+n)

You might also like