Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 21

Design and Analysis of Algorithms MCQ with Answers pdf

1. An ___ is defined as a set of well-defined instructions used to accomplish a particular


task.
a. Algorithm
b. Function
c. Program
d. Procedure
Ans: A

2. The measure of the longest amount of time possibly taken to complete an algorithm is
expressed as __.
a. Little-O
b. Little-Omega
c. Big-Omega
d. Big-O
Ans: D

3. A ___ is a compact, informal, and environment-independent description of a computer


programming algorithm.
a. Stack
b. Queue
c. Psuedocode
d. Non-linear data structure
Ans: C

4. ___ of an algorithm is the amount of time required for it to execute.


a. Time complexity
b. Space complexity
c. Compiling time
d. Best case
Ans: A

5. Potential function method is the technique that performs an amortized analysis based
on ___.
a. Financial model
b. Computational model
c. Algorithm analysis
d. Energy model
Ans: D
6. ___ is the maximum amount of time an algorithm takes to execute a specific set of
inputs.
a. Running time
b. Average case time complexity
c. Worst case time complexity
d. Best case time complexity
Ans: C

7. ___ within the limit deals with the behavior of a function for sufficiently large values of
its parameter.
a. Asymptotic notation
b. Big-Oh notation
c. Omega notation
d. Theta notation
Ans: A

34. With respect to finding the time complexity of Kruskal’s algorithm, which operation
keeps track of the parent pointer until it reaches the root parent?
a. Makeset
b. Union
c. Find
d. Merge
Ans: C

35. ___ means calculating the minimum amount of work required to solve the problem.
a. Upper-bound
b. Lower–bound
c. Adversary
d. Problem reduction
Ans: B

36. In a decision tree, a node represents a ___.


a. Input value
b. Output value
c. Solution
d. Decision
Ans: D

37. An algorithm that defines every operation exclusively is called ___ algorithm.
a. NP-hard
b. Deterministic
c. Non-deterministic
d. NP-complete
Ans: B

38. ___ problems include counting of structures of a specific kind and identifying the
largest, smallest or optimal objects.
a. Combinatorial
b. Traveling Salesman
c. Knapsack problem
d. Use cases
Ans: A

39. ___ is a sequence of data elements connected to each other where every element has a
link field referring to the location of the next element.
a. Array
b. Stack
c. List
d. Queue
Ans: C

40. ___ organizes details of all candidate solutions and discards large subsets of fruitless
candidates by using upper and lower estimated bounds of the quantity being optimized.
a. Approximation algorithms
b. Dynamic programming
c. Greedy algorithm
d. Branch and Bound
Ans: D

41. Which one of the following statements is true?


a. An algorithm should have one or more inputs externally and it should produce one or
more output.
b. An algorithm may or may not terminate after a finite number of steps.
c. To analyze an algorithm means to determine the number of resources necessary to
execute it.
d. Procedure, function and subroutine are synonyms for an algorithm.
Ans: C

34. With respect to finding the time complexity of Kruskal’s algorithm, which operation
keeps track of the parent pointer until it reaches the root parent?
a. Makeset
b. Union
c. Find
d. Merge
Ans: C

35. ___ means calculating the minimum amount of work required to solve the problem.
a. Upper-bound
b. Lower–bound
c. Adversary
d. Problem reduction
Ans: B
36. In a decision tree, a node represents a ___.
a. Input value
b. Output value
c. Solution
d. Decision
Ans: D

37. An algorithm that defines every operation exclusively is called ___ algorithm.
a. NP-hard
b. Deterministic
c. Non-deterministic
d. NP-complete
Ans: B

38. ___ problems include counting of structures of a specific kind and identifying the
largest, smallest or optimal objects.
a. Combinatorial
b. Traveling Salesman
c. Knapsack problem
d. Use cases
Ans: A

39. ___ is a sequence of data elements connected to each other where every element has a
link field referring to the location of the next element.
a. Array
b. Stack
c. List
d. Queue
Ans: C

40. ___ organizes details of all candidate solutions and discards large subsets of fruitless
candidates by using upper and lower estimated bounds of the quantity being optimized.
a. Approximation algorithms
b. Dynamic programming
c. Greedy algorithm
d. Branch and Bound
Ans: D

41. Which one of the following statements is true?


a. An algorithm should have one or more inputs externally and it should produce one or
more output.
b. An algorithm may or may not terminate after a finite number of steps.
c. To analyze an algorithm means to determine the number of resources necessary to
execute it.
d. Procedure, function and subroutine are synonyms for an algorithm.
Ans: C
41. Which one of the following statements is true?
a. An algorithm should have one or more inputs externally and it should produce one or
more output.
b. An algorithm may or may not terminate after a finite number of steps.
c. To analyze an algorithm means to determine the number of resources necessary to
execute it.
d. Procedure, function and subroutine are synonyms for an algorithm.
Ans: C

42. The two main conditions for theta notation are ___ and___.
a. f(n)=O(g(n)), f(n)≠Θ(g(n))
b. f(n)>O(g(n)), f(n)=Θ(g(n))
c. f(n)≠O(g(n)), f(n)≥Θ(g(n))
d. f(n)>O(g(n)), f(n)>Θ(g(n))
Ans: A

43. Identify the true and false statements from the following with respect to measuring the
running time of an algorithm.
1. Firstly, recognize the basic operation of an algorithm.
2. Identifying the basic operation of an algorithm is difficult.
a. 1-T, 2-F
b. 1-T, 2-T
c. 1-F, 2-T
d. 1-F, 2-F
Ans: A

44. The two primitive operations of the function Fact(x) are ___ and ___.
a. Indexing an array, comparing two numbers
b. To check if the value of x is 1, To multiply x and Fact(x-1)
c. To check if the value of x is 1, To multiply x
d. To multiply x and Fact(x-1), Compare two numbers
Ans: B

45. The smoothness rule assumes that T(n) Є Θ(n2) if ___ is a smooth function and ___ is
eventually non-decreasing.
a. n2, T(n)
b. Θ(n2), T(n)
c. T(n), n2
d. Θ(n),n
Ans: A

46. In which method of coding does the code of a symbol not depend on the frequency of
occurrence of that symbol?
a. Variable length coding
b. Fixed length coding
c. Static Huffman coding
d. Adaptive Huffman coding
Ans: B

47. Which among the following is not a reason to perform the empirical analysis?
a. To check the accuracy of the algorithm.
b. To reduce the use of mathematical analysis and algorithm visualization.
c. To compare the efficiencies of different algorithms working to solve the same problem.
d. To develop the algorithm’s efficiency class.
Ans: B

48. In distribution counting, one array is used to store ___ value and another to store ___
list of elements.
a. Frequency, Sorted
b. Distribution, Sorted
c. Frequency, Unsorted
d. Sorted, Unsorted
Ans: B

49. In a knapsack problem, if a set of items are given, each with a weight and a value, the
goal is to find the number of items that ___ the total weight and ___ the total value.
a. Minimizes, Minimizes
b. Maximizes, Maximizes
c. Maximizes, Minimizes
d. Minimizes, Maximizes
Ans: D

50. Identify true and false statements.


1. Insertion sort executes in O(n3) time.
2. Insertion sort is twice as fast as bubble sort.
a. 1-F, 2-F
b. 1-T, 2-F
c. 1-T, 2-T
d. 1-F, 2-T
Ans: D

1. The rules for performing arithmetic using Arabic numerals were originally known as
___.
Ans. Algorism

2. The efficiency of algorithms depends upon ___, ___ and ___ consumption.
Ans. Speed, size, resources

3. An algorithm is considered as the cornerstone of ___.


Ans. Good programming

4. To analyze an algorithm is to determine the number of ___ necessary to execute it.


Ans. Resources
5. ___ algorithms are used to combine sets of elements to form a single set according to
some criteria.
Ans. Merging

6. ___ is the expression of an algorithm in a programming language with all the language-
specific codes.
Ans. Programs

7. An algorithm that invokes itself within the process is called ___.


Ans. Direct recursive

8. ___ is the method of expressing the upper bound of an algorithm’s running time.
Ans. Big – O

27. ___ technique is used to perform an amortized analysis method based on a financial
model.
Ans. Accounting method

28. If you can set up such a scheme called an amortization scheme then each operation in
the series has an ___.
Ans. Amortised running time O(a)

29. ___ technique is used to perform an amortized analysis method based on an energy
model.
Ans. Potential function method

30. The running time of the algorithm prefixAverages1 is ___.


Ans. O(n2)

31. The running time of the algorithm prefixAverages2 is ___.


Ans. O(n)

32. In prefixAverages2 algorithm ___ is the time taken for initiating the variables.
Ans. O(1)

33. Recursive procedure should define a ___ which is small enough to solve without using
recursion.
Ans. Base case

34. ___ of the algorithm means analyzing the behaviour of the algorithm with a specific
set of inputs.
Ans. Empirical analysis

35. We can measure the efficiency of algorithms using ___ and ___ methods.
Ans. Counters, system clocking
36. The ___ analysis of the algorithm makes it easy to study.
Ans. Pictorial

37. ___ is defined as a technique that uses images to convey information about algorithms.
Ans. Algorithm visualization

38. ___ visualization is the type of visualization that uses still images to illustrate the
algorithm.
Ans. Static algorithm

39. ___ visualization is the type of visualization that uses animations to illustrate the
algorithm. This is also known as algorithm animation.
Ans. Dynamic algorithm

40. ___ is defined as the process that refers itself to simplify a problem.
Ans. Recursion

41. A value that satisfies the constraint is called a ___.


Ans. Feasible solution

42. ___ is a function that is associated with an optimization problem determining how
good a solution is.
Ans. Objective function

43. The running time needed to determine whether a possible value of a feasible solution is
O(n) and the time required to compute the objective function is also O(n) is ___.
Ans. O(n2n).

44. Selection sort is one of the simplest and ___ sorting techniques.
Ans. Performance-oriented

45. Bubble sort has ___, best and average case run-time of O(n2).
Ans. Worst

46. ___ is the simplest sorting algorithm.


Ans. Bubble sort

47. ___ is also known as a linear search.


Ans. Sequential search

48. We program sequential search in an array by ___an index variable until it reaches the
last index.
Ans. Stepping up
49. In this pseudocode implementation, we execute the ___ only after all list items are
examined with none matching.
Ans. Last line

50. Exhaustive search implementation is more important than ___.


Ans. Speed

51. Exhaustive search algorithm gives the ___ for every candidate that is a solution to the
given instance P.
Ans. Output

52. Exhaustive search is typically used when the problem size is ___.
Ans. Limited

53. ___ need very few lines of code as it performs the same process again and again on
different data.
Ans. Recursive algorithms

54. In the towers of Hanoi problem, if the numbers of disks is n, the number of steps will
be___.
Ans. 2n-1

55. Unlike the merge sort, which breaks up its input elements according to their position in
the array, quick sort breaks them according to their ___.
Ans. Value

56. After the partition, if the pivot is inserted at the boundary between the ___ sub-arrays,
it will be in its final sorted position.
Ans. Left and right

57. Binary search is an algorithm for identifying the position of an element in a ___ array.
Ans. Sorted

58. Say if the following statement is true or false. To find a value in an unsorted array, we
need to scan through only half the elements of an array.
Ans. False

59. Say if the following statement is true or false. The benefit of binary search is that its
complexity depends on the array size logarithmically.
Ans. True

60. ___ methodology can solve most of the problems regarding binary trees.
Ans. Divide and Conquer

61. The three typical traversals: ___, ___, and ___ are the most important Divide and
Conquer algorithms of binary trees.
Ans. Pre-order, in-order, post-order
62. Two kinds of traversal are ___ and ___.
Ans. Breadth-first traversal, depth-first traversal

63. At the expense of a slight increase in the number of additions, the strassen’s matrix
multiplication algorithm will ___ the total number of multiplications performed.
Ans. Decrease

64. The normal method of matrix multiplication of two n X n matrices takes ___
operators.
Ans. O()

65. By Strassen’s matrix multiplication algorithm, two 2 X 2 matrices takes 2 only 7


multiplicators and ___ adders.
Ans. 18

66. Mergesort is a perfect example of a successful application of the ___ and ___
methodology.
Ans. Divide, Conquer

67. ___ is a comparison-based sorting.


Ans. Mergesort

68. What are the three steps involved in mergesort?


Ans. Divide, recur, conquer

69. If the array has two or more cells, the algorithm calls the ___ method.
Ans. Partition

70. Decrease and conquer can be implemented by a ___ or ___ approach.


Ans. Top-down or Bottom-up

71. ___, ___ & ___ are three instances of the transform and conquer technique.
Ans. Instance simplification, problem reduction, representation change

72. Decrease and conquer is also known as ___ approach.


Ans. Incremental

73. Decrease and conquer is a method by which we find a solution to a given problem
based upon the ___ of a number of problems.
Ans. Solution

74. There are ___ major categories in insertion sort.


Ans. Two

75. In insertion sort, the best case input is an array that is already ___.
Ans. Sorted
Q. 1. Which Data Structure is used to perform Recursion?
A : Array
B : queue
C : stack
D : linked list
stack

Q. 2. What is the objective of the knapsack problem?


A : To Get Maximum Total Value In The Knapsack
B : To Get Minimum Total Value In The Knapsack
C : To Get Maximum Weight In The Knapsack
D : To Get Minimum Weight In The Knapsack
To Get Maximum Total Value In The Knapsack
Q. 3. Which of the following algorithm can be used to solve the Hamiltonian path problem
efficiently?
A : branch and bound
B : iterative improvement
C : divide and conquer
D : greedy algorithm
branch and bound

Q. 4. What is the worst case time complexity of merge sort?


A : O(N Log N)
B : O(n*n)
C : O(Log N)
D : O(Log Log N)
O(N Log N)

Q. 5. What is tail recursion?


A : A recursive function that has two base cases
B : A function where the recursive functions leads to an infinite loop
C : A recursive function where the function doesn’t return anything and just prints the
values
D : A function where the recursive call is the last thing executed by the function
A function where the recursive call is the last thing executed by the function

Q. 6. What is best case complexity of selection sort


A: n
B : n^2
C : nlogn
D:

Q. 8. Fractional knapsack problem is also known as


A : 0/1 knapsack problem
B : Continuous knapsack problem
C : Divisible knapsack problem
D : Non continuous knapsack problem
Q. 9. Algorithm can be represented as
A : Pseudocode
B : Flowchart
C : None of the above
D : both 1and 2
both 1and 2

Q. 10. What approach is being followed in Floyd Warshall Algorithm?


A : Greedy Technique
B : Dynamic Programming
C : Linear Programming
D : Backtracking
Dynamic Programming

Q. 11. Which of the following algorithms has worst time complexity?


A : insertion sort
B : binary search
C : linear search
D : merge sort insertion sort

Q. 12. Which data structure is used for implementing a FIFO branch and bound strategy?
A : Stack
B : Queue
C : Array
D : Linked List
Queue

Q. 13. What is the average case time complexity of merge sort?


A : O(N Log N)
B : O(n*n)
C : O(Log N)
D : O(Log Log N)

O(N Log N)

Q. 14. q29.jpeg
A : 111
B : 101
C : 110
D : 11
110

Q. 15. Alorithm should have finite number of steps


A : true
B : false
C:
D:
true
Q. 16. Two main measures for the efficiency of an algorithm are 1)time 2) space 3) lines of code
A : 1 and 2
B : 2 and 3
C : 1 and 3
D:
1 and 2

Q. 17. Fractional knapsack problem is solved most efficiently by which of the following algorithm?
A : Divide And Conquer
B : Dynamic Programming
C : Greedy Algorithm
D : Backtracking
Greedy Algorithm

Q. 18. What is adaline in neural networks?


A : Adaptive Linear Element
B : Automatic Linear Element
C : Adaptive Line Element
D : Adaptive Nonlinear Element

Adaptive Linear Element

Q. 19. What are dendrites?


A : Fibers Of Nerves
B : nuclear projections
C : Other Name For Nucleus
D : Twisted Network
Fibers Of Nerves

Q. 20. Hamiltonian path problem is _________


A : NP problem
B : N class problem
C : P class problem
D : NP complete problem

Q. 22. An algorithm that always runs in polynomial time but possibly returns erroneous answers is called a
…………
A : Las Vegas Algorithm
B : Monte Carlo Algorithm
C : Atlantic City Algorithm
D : Approximation algorithm

Monte Carlo Algorithm


Q. 23. Which algorithm startegy builds up a solution by choosing the option that looks the best at
every step.
A : greedy method
B : branch and bound
C : dynamic programming
D : divide and conquer
greedy method

Q. 24. which is not the important aspect of Loop


A : Initial condition
B : nested loop
C : invariant relation
D : termination
nested loop

Q. 25. Choose the correct steps to prove if the vertex cover problem is NPComplete. I– Vertex Cover
problem is in NP II–Clique problem is in NP III–Prove that Clique problem ≤ Vertex Cover Problem
in polynomial time IV—Prove that Vertex Cover problem ≤ Clique Problem in polynomial time
A : I and III
B : I and IV
C : II and III
D : II and IV
I and III

Q. 26. Running the program many times is sufficient to prove the correctness of program
A : true
B : false
C:
D:
false

Q. 27. 0/1 knapsack is based on which method?


A : greedy method
B : branch and bound
C : dynamic programming
D : divide and conquer
dynamic programming

Q. 28. Dynamic programming is used to find:


A : All Optimal Solution Is Generated
B : One Solution Is Generated
C : No Optimal Solution Is Generated
D : Partial Solution Is Generated
All Optimal Solution Is Generated
Q. 29. What is the purpose of using randomized quick sort over standard quick sort?
A : To reduce worst case space complexity
B : To reduce worst case time complexity
C : To improve average case time complexity
D : To improve accuracy
To reduce worst case time complexity

Q. 30. which of the following is not basic control structure


A : the process
B : the decision
C : the loop
D : the sequential the process

Q. 31. If T= abcabaabc & P= abaa then what will be the value of s?


A: 4
B:2
C:3
D:1
3

Q. 32. Which data structure has a better amortized running time than others?
A : Queue
B : Stack
C : Priority Queue
D : List
Priority Queue

Q. 33. Which of the following statement about 0 1 knapsack and fractional knapsack problem is
correct?
A : In 0 1 knapsack problem items are divisible and in fractional knapsack items are
indivisible
B : Both are the same
C : 0 1 knapsack is solved using a greedy algorithm and fractional knapsack is solved
using dynamic
programming
D : In 0 1 knapsack problem items are indivisible and in fractional knapsack items are
divisible
In 0 1 knapsack problem items are indivisible and in fractional knapsack items are divisible

Q. 34. Which data structure is most suitable for implementing best first branch and bound strategy?
A : Stack
B : Queue
C : Priority Queue
D : Linked List

Priority Queue
Q. 35. Time taken in decreasing the node value in a binomial heap is
A : O(n)
B : O(1)
C : O(log n)
D : O(n log n)
O(log n)
Q. 36. Multithreaded computation can be better understood with the help of a
A : Computation undirected acyclic graph
B : Computation directed cyclic graph
C : Computation directed acyclic graph
D : Computation undirected cyclic graph

Computation directed acyclic graph

Q. 37. Which of the following is/are property/properties of a dynamic programming problem?


A : Evolutionary Approach
B : Require More Time
C : Greedy Approach
D : Optimal Substructure And Overlapping Subproblems

Optimal Substructure And Overlapping Subproblems

Q. 38.
A : 10
B:1
C : 10 9 8 ……1 0
D : 10 9 8 ……1

10 9 8 ……1

Q. 39. What are desirable characteristics of Algorithm with efficiency 1)Generality 2) Availability 3)
Simplicity
A : 1 and 2
B : 2 and 3
C : 1 and 3
D:
1 and 3

Q. 40. we can refere to the common sense/ intution while specifing the
algorithm
A : true
B : false
C:
D:
false
Q. 41. What are requirements should a problem satisfy in order to be suitable for solving it by a
Genetic Algorithm?
A : The Fitness Function Cannot Be Well–Defined.
B : Solutions Should Be Decomposable Into Steps (Building Blocks) Which Could Be
Then Encoded As Chromosomes.
C : The Member Function Can Be Well–Defined.
D : Minimize Functions
Solutions Should Be Decomposable Into Steps (Building Blocks) Which Could Be Then Encoded As
Chromosomes.

Q. 42. What is the feature of ANNs due to which they can deal with noisy, fuzzy, inconsistent data?
A : Non Associative Nature Of Networks
B : Distributive Nature Of Networks
C : Non Distributive Nature Of Networks
D : Is A Meta Heuristic Search Method

Distributive Nature Of Networks

Q. 43. Basic operations like insertion, look-up and removal in splay trees are performed in …….
time.
A : O(1)
B : O(n)
C : O(log n)
D : O(n log n)
O(log n)

Q. 44. Mathematical induction can be used to prove that, for any positive integer n, “Summation of
first 1 to n numbers ” is
A : n(n+1)/2
B : n^2(n+1)^2/2
C : n(n-1)/2
D:
n(n+1)/2

Q. 45. Which of the following methods can be used to solve the Knapsack problem?
A : Divide And Conquer
B : Sorting Algorithm
C : Monte-Carlo Algorithm
D : Brute Force, Recursion And Dynamic Programming
Brute Force, Recursion And Dynamic Programming

Q. 46. Identify incorrect statement


A : f(n) = Θ(g(n)) and g(n) = Θ(h(n)), then f(n) = Θ(h(n))
B : f(n) = Θ(g(n)) if and only if g(n) = Θ(f(n))
C : f(n) = O(g(n)) if and only if g(n) = Ω(f(n))
D : If f(n) = O(g(n)) and g(n) = O(h(n)), then f(n) ≠ O(h(n))
If f(n) = O(g(n)) and g(n) = O(h(n)), then f(n) ≠ O(h(n))

Q. 47. Tabu search is


A : A Binary Search Method
B : Mathematical Optimization Method
C : Non Associative
D : The Acceptance Probability Function Is Used
Mathematical Optimization Method

Q. 48. Core of soft Computing is


A : Fuzzy Computing, Neural Computing, Genetic Algorithms
B : Fuzzy Networks And Artificial Intelligence
C : Artificial Intelligence And Neural Science
D : Neural Science And Genetic Science
Fuzzy Computing, Neural Computing, Genetic Algorithms

Q. 49. algorithms performance is characterized by


A : size of a computation
B : computing resources required
C : actual time required
D : actual memory required
size of a computation

Q. 50. Find out one solution store it in solution set again find out another solution store in it solution
set, again find out the another solution store into the solution set, now from the solution set we find
out the best solution, which maybe best solution for optimal solution, this is which type of solution
strategy?
A : Dynamic programming
B : Greedy method
C : backtracking
D : Neither Dynamic Nor Greedy
Greedy method

Q. 51. Given items as {value,weight} pairs {{60,20},{50,25},{20,5}}. The capacity of knapsack=40.


Find the maximum value output assuming items to be divisible and nondivisible respectively.
A : 10080
B : 11070
C : 130110
D : 11080
11080

Q. 52. Time complexity of LCS Select one:


A : O(M!)
B : O(Mn)
C : O(N!)
D : O(N)
O(Mn)

Q. 53. In greedy method which type of solution is generated


A : Optimal solution
B : Best solution
C : Worst solution
D : All solutions
Optimal solution

Q. 54. What are the issues on which biological networks proves to be superior than AI networks?
A : Robustness & Fault Tolerance
B : Inflexibility
C : Single Computation
D : No Computation

Robustness & Fault Tolerance

Q. 55. What is time complexity of fun()? int fun(int n)


{
int count = 0;
for (int i = n; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count += 1;
return count;
}
A : O(nlog n)
B : O(n^2 )
C : O( n)
D : O(log n)
O( n)

Q. 56. The name backtrack was first coined by _________


A : D.H.Lehmer
B : L.Baumert
C : R.J.Walker
D : S. Golomb
D.H.Lehmer

Q. 57. Assertion is
A : statement that is true all the time
B : statement about state of program
C : statement describing program statement
D:
statement about state of program
Q. 58. what are the ways to remove the redundant computation outside the
loop
A : Code motion
B : frequency reduction
C : Strength reduction
D : All of these
All of these

Q. 59. If a problem can be broken into subproblems which are reused several times, the problem
possesses ____________ property.
A : Overlapping Subproblems
B : Optimal Substructure
C : Memoization
D : Greedy
Overlapping Subproblems

Q. 60. Given items I = (I1,I2,I3,I4,I5), w = (5, 10, 20, 30, 40) and v = (30, 20, 100, 90,160). The capacity
of knapsack W = 60. Find the maximum profit using fractional knapsack.
A : 250
B : 270
C : 290
D : 130

1. What is an algorithm?
A A flowchart
B A flowchart or pseudocode
C A decision
D Step by step instructions used to solve a problem

 D

You might also like