Professional Documents
Culture Documents
MCQ, Design and Analysis of Algorithm
MCQ, Design and Analysis of Algorithm
Shubham Mahto
301302219122
4th
OBJECTIVE QUESTIONS
Link will be close at 10:45 AM, within this time slot you have to submit.
Qu.1 The complexity of searching an element from a set of n elements using Binary search algorithm is
(1 Point)
a. O(n log n)
b. O(log n)
c. O(n2)
d. O(n)
Qu.2 Which case of Master’s theorem is applicable in the recurrence relation T(n)=0.5*T(n/2)+1/n?
(1 Point)
a. Case 3
b. Case 1
d. Case 2
Qu.3 How many passes does an insertion sort algorithm consist of?
(1 Point)
a) N
b) N-1
c) N+1
d) N2
7
Qu.4 For the following question, how will the array elements look like after second pass?
34, 8, 64, 51, 32, 21
(1 Point)
Qu.5 Which of the following sorting algorithms is the fastest for sorting small arrays?
(1 Point)
a) Quick sort
b) Insertion sort
c) Shell sort
d) Heap sort
A - LIFO
B - FIFO
C - FILO
10
B - spanning tree
C - sparse tree
11
Qu.8 Which of the following algorithm does not divide the list −
(1 Point)
A - linear search
B - binary search
C - merge sort
D - quick sort
12
Qu.9 Which of the following algorithms is NOT a divide & conquer algorithm by nature?
(1 Point)
(A) Euclidean algorithm to compute the greatest common divisor
13
Qu.10 Consider a situation where you don’t have function to calculate power (pow() function in C) and
you need to calculate x^n where x can be any number and n is a positive integer. What can be the best
possible time complexity of your power function?
(1 Point)
(A) O(n)
(B) O(nLogn)
(C) O(LogLogn)
(D) O(Logn)
14
Qu.11 Which of the following sorting algorithms has the lowest worst-case complexity?
(1 Point)
int cse(n,m)
{
if (n%m ==0) return m;
n = n%m;
return cse(m,n);
}
(A) Θ(log2n)
(B) Ω(n)
(C) Θ(log2log2n)
(D) Θ(n√)
16
a. f(n)=n/2+n^2
b. f(n)=n/2
c. f(n)=n^2
d. f(n)=3n/2
17
Qu.14 Which of the following asymptotic notation is the worst among all?
(1 Point)
A - Ο(n+9378)
B - Ο(n3)
C - nΟ(1)
D - 2Ο(n)
18
19
Qu.16 Suppose we run Dijkstra’s single source shortest-path algorithm on the following edge weighted
directed graph with vertex P as the source. In what order do the nodes get included into the set of vertices
for which the shortest path distances are finalized?
(1 Point)
(A) P, Q, R, S, T, U
(B) P, Q, R, U, S, T
(C) P, Q, R, U, T, S
(D) P, Q, T, R, U, S
20
Qu.17 Which of the following is true about Kruskal and Prim MST algorithms? Assume that Prim is
implemented for adjacency list representation using Binary Heap and Kruskal is implemented using union
by rank.
(1 Point)
21
a) Greedy algorithm
b) 2D dynamic programming
c) 1D dynamic programming
22
Qu.19 You are given a knapsack that can carry a maximum weight of 60. There are 4 items with weights
{20, 30, 40, 70} and values {70, 80, 90, 200}. What is the maximum value of the items you can carry
using the knapsack?
(1 Point)
a) 160
b) 200
c) 170
d) 90
23
Qu.20 Space complexity of an algorithm is the maximum amount of _______ required by it during
execution.
(1 Point)
a. Time
b. Operations
c. Memory space
Qu.21 For many problems such as sorting, there are many choices of algorithms to use, some of which
are extremely___________.
(1 Point)
a. Space efficient
b. Time efficient
25
Qu.22 To verify whether a function grows faster or slower than the other function, we have some
asymptotic or mathematical notations, which is_________.
(1 Point)
c. Big Oh O (f)
26
Qu.23 The amount of time the computer needs to run to completion is known as_____.
(1 Point)
a. Space complexity
b. Time complexity
c. Recursive function
27
Qu.24 ___________algorithm is one which utilizes minimum processor time and requires minimum
memory space during its execution.
(1 Point)
a. Best
b. Efficient
28
a. it can be used to decide the best algorithm that solves a given problem
b. it determines the maximum size of a problem that can be solved in a given system, in a given amount of
time
d. none of these
29
c. Sometimes more complicated and some other times simpler than that of worst case
30
a. O(n)
b. O(log n)
c. O(n2)
d. O(n log n)
31
Qu.28 The complexity of multiplying two matrices of order m*n and n*p is
(1 Point)
a. mnp
b. mp
c. mn
d. np
32
Qu.29 Let w(n) and A(n) denote respectively, the worst case and average case running time of an
algorithm executed on an input of size n. which of the following is ALWAYS TRUE?
(A) A(n) = \Omega(W(n))
(B) A(n) = \Theta(W(n))
(C) A(n) = O(W(n))
(D) A(n) = o(W(n))
(1 Point)
(A) A
(B) B
(C) C
(D) D
33
A-0
B-1
C - either 0 or 1
D - undefined
34
a) A condition where any two vertices having a common edge should not have same color
b) A condition where any two vertices having a common edge should always have same color
35
How many unique colors will be required for proper vertex coloring of a complete graph having n
vertices?
(1 Point)
a) 0
b) 1
c) n
d) n!
36
a) Hamiltonian cycle
37
a) n-queen’s problem
b) 8-queen’s problem
38
a) greedy algorithm
c) iterative improvement
d) backtracking
39
Which of the following algorithms is the best approach for solving Huffman codes?
(1 Point)
exhaustive search
greedy algorithm
40
The code length does not depend on the frequency of occurrence of characters.
(1 Point)
True
False
41
a) intractable
b) tractable
c) decision
d) complete
42
b) 2
c) 3
d) 4
43
(A) If we want to prove that a problem X is NP-Hard, we take a known NP-Hard problem Y and reduce Y
to X
(B) The first problem that was proved as NP-complete was the circuit satisfiability problem.
44
Which of the following can traverse the state space tree only in DFS manner?
(1 Point)
B : dynamic programming
C : greedy algorithm
D : backtracking
46
Which data structure is most suitable for implementing best first branch and bound strategy?
(1 Point)
a) stack
b) queue
c) priority queue
d) linked list
47
b) branch and bound is not suitable where a greedy algorithm is not applicable
c) branch and bound divides a problem into at least 2 new restricted sub problems
d) backtracking divides a problem into at least 2 new restricted sub problems
48
Both LIFO branch and bound strategy and backtracking leads to depth first search.
(1 Point)
a) true
b) false
This content is created by the owner of the form. The data you submit will be sent to the form owner. Microsoft is not responsible for the privacy or security
practices of its customers, including those of this form owner. Never give out your password.