Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MCQ, Design and Analysis of Algorithm

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

MCQ, DESIGN AND ANALYSIS OF ALGORITHM

CSE 4th sem ( Bhilai )

Enter Your Name *

Shubham Mahto

Enter Your University Roll No. *

301302219122

Enter Your SEMESTER *

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

c. Master’s theorem is not applicable

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)

a) 8, 21, 32, 34, 51, 64

b) 8, 32, 34, 51, 64, 21

c) 8, 34, 51, 64, 32, 21

d) 8, 34, 64, 51, 32, 21

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

Qu.6 Queue data structure works on


(1 Point)

A - LIFO

B - FIFO
C - FILO

D - none of the above

10

Qu.7 Heap is an example of


(1 Point)

A - complete binary tree

B - spanning tree

C - sparse tree

D - binary search 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

(B) Heap Sort

(C) Cooley-Tukey fast Fourier transform

(D) Quick Sort

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)

(A) Merge sort

(B) Bubble sort

(C) Quick sort

(D) Selection sort


15

Qu.12 In the following C function, let n ≥ m.

int cse(n,m)
{
if (n%m ==0) return m;
n = n%m;
return cse(m,n);
}

How many recursive calls are made by this function?


(1 Point)

(A) Θ(log2n)

(B) Ω(n)

(C) Θ(log2log2n)

(D) Θ(n√)

16

Qu.13 Apply Master theorem to T(n)=3.T(n/2)+n^2 and write what is f(n).


(1 Point)

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

Qu.15 Which of the following standard algorithms is not a Greedy algorithm?


(1 Point)

(A) Dijkstra’s shortest path algorithm

(B) Prim’s algorithm

(C) Kruskal algorithm

(D) Bellmen Ford Shortest path algorithm

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)

(A) Worst case time complexity of both algorithms is same.

(B) Worst case time complexity of Kruskal is better than Prim

(C) Worst case time complexity of Prim is better than Kruskal

(D) None of these

21

Qu.18 The Knapsack problem is an example of ____________


(1 Point)

a) Greedy algorithm
b) 2D dynamic programming

c) 1D dynamic programming

d) Divide and conquer

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

d. None of the above


24

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

c. Both (a) and (b)

d. None of the above

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)

a. Big Omega Ω (f)

b. Big Theta θ (f)

c. Big Oh O (f)

d. All of the above

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

d. None of the above

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

c. Both (a) and (b)

d. None of the above

28

Qu.25 The concept of order (Big O) is important because


(1 Point)

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

c. all of the above

d. none of these
29

Qu.26 The complexity of the average case of an algorithm is


(1 Point)

a. Much more complicated to analyze than that of worst case

b. Much more simpler to analyze than that of worst case

c. Sometimes more complicated and some other times simpler than that of worst case

d. None of the above

30

Qu.27 The complexity of linear search algorithm is


(1 Point)

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

Qu.30 Index of arrays in C programming langauge starts from


(1 Point)

A-0

B-1

C - either 0 or 1

D - undefined
34

What is vertex coloring of a graph?


(1 Point)

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

c) A condition where all vertices should have a different color

d) A condition where all vertices should 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

Which of the following is an NP complete problem?


(1 Point)

a) Hamiltonian cycle

b) Travelling salesman problem


c) Calculating chromatic number of graph

d) Finding maximum element in an array

37

Placing n-queens so that no two queens attack each other is called?


(1 Point)

a) n-queen’s problem

b) 8-queen’s problem

c) Hamiltonian circuit problem

d) subset sum problem

38

Which of the following methods can be used to solve n-queen’s problem?


(1 Point)

a) greedy algorithm

b) divide and conquer

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

brute force algorithm

divide and conquer algorithm

40

The code length does not depend on the frequency of occurrence of characters.
(1 Point)

True

False

41

Problems that can be solved in polynomial time are known as?


(1 Point)

a) intractable

b) tractable

c) decision

d) complete

42

How many stages of procedure does a non-deterministic algorithm consist of?


(1 Point)
a) 1

b) 2

c) 3

d) 4

43

Which of the following is true about NP-Complete and NP-Hard problems.


(1 Point)

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

(C) NP-complete is a subset of NP Hard

(D) All of the above

44

The travelling salesman problem can be solved in :


(1 Point)

Polynomial time using dynamic programming algorithm

Polynomial time using branch-and-bound algorithm

Exponential time using dynamic programming algorithm or branch-and-bound algorithm

Polynomial time using backtracking algorithm


45

Which of the following can traverse the state space tree only in DFS manner?
(1 Point)

A : branch and bound

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

Choose the correct statement from the following.


(1 Point)

a) branch and bound is more efficient than backtracking

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

Go back to thank you page

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.

Powered by Microsoft Forms | Privacy and cookies | Terms of use

You might also like