Professional Documents
Culture Documents
Data Structures and Algorithms MCQ Questions Set 02
Data Structures and Algorithms MCQ Questions Set 02
Data Structures and Algorithms MCQ Questions Set 02
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
d. none of above
b. data elements in linked list need not be stored in adjacent space in memory
d. linked lists are collection of the nodes that contain information part and next pointer
a. FAEKCDBHG
b. FAEKCDHGB
c. EAFKHDCBG
d. FEAKDCHBG
a. floor address
b. foundation address
c. first address
d. base address
a. An array is suitable for homogeneous data but the data items in a record may have different
data type
d. All of above
a. FIFO lists
b. LIFO list
c. Piles
d. Push-down lists
a. linear arrays
b. linked lists
c. both of above
d. none of above
b. lists
c. stacks
d. all of above
10. The memory address of fifth element of an array can be calculated by the formula
d. None of above
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
a. underflow
b. overflow
c. housefull
d. saturated
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
b. requirement of sorted array is expensive when a lot of insertion and deletions are needed
d. binary search algorithm is not efficient when the data elements are more than 1000.
18. Binary search algorithm can not be applied to
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?
b. there should be the direct access to the middle element in any sublist
d. none of above
ALL CATEGORIES /
a. Exhibits the worst case performance when the initial array is sorted in reverse order.
c. Can be compared to the way a card player arranges his card from a card deck.
a. Tree
b. Heap
c. Hash Table
d. Linked-List
a. Bubble Sort
b. Quick Sort
c. Merge Sort
d. Insertion Sort
Answer: (b).Quick Sort
a. Selection Sort
b. Bubble Sort
c. Merge Sort
d. Insertion Sort
Answer: (a).Selection Sort
a. Merge Sort
b. Quick Sort
c. Insertion Sort
d. Selection Sort
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Quick Sort
a. linear search
b. binary search
c. merge sort
d. quick sort
Answer: (a).linear search
a. Ο(m | n)
b. Ο(m + n)
c. Ο(m log n)
d. Ο(n log m)
Answer: (b).Ο(m + n)
a. Greedy approach
c. Dynamic Programming
d. Divide and conquer
a. size of array
b. pivot element
c. sequence of values
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
a. Binary Search
b. Interpolation Search
c. Linear Search
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. 4
b. 5
c. 6
d. 7
Answer: (a).4
14. An adaptive sorting algorithm −
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
a. interpolation search
b. linear search
c. merge sort
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
Answer: (a).Linear search
a. True, False
b. False, True
c. False, False
d. True, True
a. Insertion Sort
b. Bubble Sort
c. Merge Sort
d. Heap Sort
Answer: (c).
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
d. When Item is the last element in the array or is not there at all
24. Which of the following is not the required condition for binary search algorithm?
b. there should be the direct access to the middle element in any sublist
d. none of above
b. requirement of sorted array is expensive when a lot of insertion and deletions are needed
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
d. pointer array
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
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
Answer: (d).Insertion sort
a. Binary Search
b. Linear Search
c. Tree Search
d. Hashing
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
Answer: (c).Hashing
DATA STRUCTURES AND ALGORITHMS /
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
Answer: (b).5
a. O (n log n)
b. O (n^2 /2)
c. O (log n)
d. O (n^2 /4)
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
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
Answer: (b).Merge sort
a. Greedy
b. Dynamic programming
d. Backtracking
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
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)
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
Answer: (a).Bubble Sort
a. merge sort
b. heap sort
c. bubble sort
d. none of these
Answer: (d).none of these
a. O(1) time
b. O(n^2 ) time
c. O(log n ) time
Answer: (a).O(1) time
a. Quick Sort
b. Merge Sort
c. Insertion Sort
d. Heap Sort
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)
Answer: (d).O(n^2)
43. A characteristic of the data that binary search uses but the linear search ignores is the___________.
a. insertion sort
b. bubble sort
c. quick sort
d. heap sort
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
Answer: (a).log2 n
a. O(n^2 )
b. O(n)
c. O (n log2 n)
d. O (log2 n)
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
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
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
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
d. Inflecting
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
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
d. Data structures
a. (ii) only
b. (i) only
d. None is correct
Answer: (b).(i) only
a. 1956
b. 1946
c. 1916
d. 1936
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
Answer: (d).Sorting
b. 2001
c. 2008
d. 1998
Answer: (a).2004
a. Records
b. Arrays
c. Information
d. Data
Answer: (a).Records
a. Bubble sort
b. Insertion sort
c. Unsorted arrays
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
Answer: (a).Insertion sort
a. Quick sort
b. Heap sort
c. Merge sort
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
Answer: (a).List
62. An array sorted in the reverse order is the __________ case input.
a. Worst
b. Best
c. Somewhat bad
Answer: (a).Worst
a. Insertion sort
b. Selection sort
c. Sorting array
Answer: (b).Selection sort
a. G(N*lgN)
b. N(N*lgN)
c. O(N*lgN)
Answer: (c).O(N*lgN)
65. There is one to one correspondence between elements of the _________of the tree.
66. To perform the heap sort, you need to create a tree with all nodes greater than their __________.
a. Sibling
b. Children
c. Parents
Answer: (b).Children
a. Selection sort
b. Tree sort
c. Heap sort
d. Quick sort
Answer: (d).Quick sort
a. Numerical order
b. Lexicographical order
Answer: (b).Lexicographical order
a. External searching
b. Brute-force search
c. Search space
Answer: (c).Search space
b. Uninformed algorithm
d. Search algorithm
a. Table
b. File
d. Column
72. When the records are stored in __________ or any secondary storage, then the searching is known as extern
a. Disk
b. Files
c. Tape
a. Fibonacci search
b. Binary search
c. Linear search
Answer: (c).Linear search
a. N(log N)
b. S(log N)
c. O(log N)
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
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
Answer: (a).10
a. Bubble Sort
b. Merge Sort
c. Insertion Sort
Answer: (b).Merge Sort
a. O(n^2)
b. O(n)
c. O(n log n)
d. O(log n)
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
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
Answer: (c).10
a. O(n)
b. O(2n)
c. O(n^2)
d. O(log n)
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
Answer: (a).Insertion sort
a. insertion sort
b. merge sort
c. selection sort
d. quick sort
Answer: (a).insertion sort
84. A desirable choice for the partitioning element in quick sort is
a. Quick Sort
b. Heap Sort
c. Shell Sort
d. Bubble Sort
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
Answer: (b).3
87. A sorting algorithm is stable if
88. For a binary search algorithm to work, it is necessary that the array must be ............
a. sorted
b. unsorted
c. in a heap
Answer: (a).sorted
List - I
i. Bubble Sort
ii. Shell Sort
iii. Selection Sort
List - II
a. Ο(n)
b. Ο(n2)
c. Ο(n log n)
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)
Answer: (a).O(n)
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
Answer: (c).Quick sort
a. O(2^n)
b. O(n^3)
c. O(n^2)
d. O(2n)
Answer: (c).O(n^2)
95. Linear search is highly inefficient compared to binary search when dealing with:
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
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
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
Answer: (b).Quick sort
99. The search technique for searching a sorted file that requires increased amount of space is ................
b. Interpolation search
c. Sequential search
d. Tree 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))
Answer: (c).O(m+n)