MCQ in DAA
MCQ in DAA
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
2. An algorithm is made up of two independent time complexities f (n) and g (n). Then
the complexities of the algorithm is in the order of
a. f(n) x g(n)
b. Max ( f(n),g(n))
c. Min (f(n),g(n))
d. f(n) - g(n)
4. A certain algorithm A has been shown to have a running time O(N2.5) the size of the
input. Which of the following is NOT true about algorithm A?
a. There exists two non-negative constants C1 and C2 such that for all N the
running time is less than C1N2.5+C2 seconds
b. For all N, there may be some inputs for which running time is less than N2.4
seconds
c. For all N, there may be some inputs for which running time is less than N2.5
seconds
d. For all N, there may be some inputs for which running time is more than N2.5
seconds
5. 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
6. The worst case running time to search for an element in a balanced binary search tree
with n2n elements is
(a) O(nlogn) (b) O(n2n) (c) O(n) (d) O(logn)
10. Which of the following relationship between number of back edges and number of
cycles in DFS is false?
a. No back edges means no cycles.
b. Number of back edges is equal to number of cycles
c. One back edge may result in one to exponential number of simple cycles
d. None of the above
11. Let w be the minimum weight among all edge weights in an undirected connected
graph. Let e be a specific edge of weight w. Which of the following is FALSE?
a. There is a minimum spanning tree containing e.
b. If e is not in a minimum spanning tree T, then in the cycle formed by adding e
to T, all edges have the same weight
c. Every minimum spanning tree has an edge of weight w .
d. e is present in every minimum spanning tree
14. The lower bound for worst case time complexity for any comparison sorting
algorithm is
a. Ω(log n)
b. Ω(n log n)
c. Ω(n2)
d. Ω(n)
15. T1(n) ∈Θ(g1(n)) ∧T2(n) ∈Θ(g2(n)) ⇒T1(n) + T2(n) ∈Θ(max{g1(n), g2(n)}) says that
a. the slower and faster parts of an algorithm together set its running time;
b. the faster part of an algorithm dominates in determining running time;
c. the slower part of an algorithm dominates in determining running time;
d. Algorithm T finds the maximum of g1and g2
20. Consider the process of inserting an element into a Max Heap, where the Max Heap
is represented by an array. Suppose we perform a binary search on the path from the
new leaf to the root to find the position for the newly inserted element, the number of
comparisons performed is:
a. log n
b. log log n
c. n
d. n log n