Design And Analysis Of Algorithms Set 9

On This Page

This set of Design and Analysis of Algorithms Multiple Choice Questions & Answers (MCQs) focuses on Design And Analysis Of Algorithms Set 9

Q1 | Floyd- Warshall algorithm was proposed by                          
  • robert floyd and stephen warshall
  • stephen floyd and robert warshall
  • bernad floyd and robert warshall
  • robert floyd and bernad warshall
Q2 | Who proposed the modern formulation of Floyd-Warshall Algorithm as three nested loops?
  • robert floyd
  • stephen warshall
  • bernard roy
  • peter ingerman
Q3 | What happens when the value of k is 0 in the Floyd Warshall Algorithm?
  • 1 intermediate vertex
  • 0 intermediate vertex
  • n intermediate vertices
  • n-1 intermediate vertices
Q4 | Using logical operator’s instead arithmetic operators saves time and space.
  • true
  • false
Q5 | The time taken to compute the transitive closure of a graph is Theta(n2).
  • true
  • false
Q6 | If a problem can be broken into subproblems which are reused several times, the problem possesses                           property.
  • overlapping subproblems
  • optimal substructure
  • memoization
  • greedy
Q7 | When dynamic programming is applied to a problem, it takes far less time as compared to other methods that don’t take advantage of overlapping subproblems.
  • true
  • false
Q8 | A greedy algorithm can be used to solve all the dynamic programming problems.
  • true
  • false
Q9 | In dynamic programming, the technique of storing the previously calculated values is called                        
  • saving value property
  • storing value property
  • memoization
  • mapping
Q10 | When a top-down approach of dynamic programming is applied to a problem, it usually                            
  • decreases both, the time complexity and the space complexity
  • decreases the time complexity and increases the space complexity
  • increases the time complexity and decreases the space complexity
  • increases both, the time complexity and the space complexity
Q11 | Which of the following problems is NOT solved using dynamic programming?
  • 0/1 knapsack problem
  • matrix chain multiplication problem
  • edit distance problem
  • fractional knapsack problem
Q12 | Which of the following problems should be solved using dynamic programming?
  • mergesort
  • binary search
  • longest common subsequence
  • quicksort
Q13 | What is the time complexity of the recursive implementation used to find the nth fibonacci term?
  • o(1)
  • o(n2)
  • o(n!)
  • exponential
Q14 | What is the space complexity of the recursive implementation used to find the nth fibonacci term?
  • o(1)
  • o(n)
  • o(n2)
  • o(n3)
Q15 | return fibo_terms[n]
  • o(1)
  • o(n)
  • o(n2)
  • exponential
Q16 | return fibo_terms[n]
  • o(1)
  • o(n)
  • o(n2)
  • exponential
Q17 | You are given infinite coins of denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. This problem can be solved using
  • greedy algorithm
  • dynamic programming
  • divide and conquer
  • backtracking
Q18 | Suppose you have coins of denominations 1,3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is not greater than the remaining sum. For which of the following sums, will the algorithm produce an optimal answer?
  • 14
  • 10
  • 6
  • 100
Q19 | You are given infinite coins of N denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the time complexity of a dynamic programming implementation used to solve the coin change problem?
  • o(n)
  • o(s)
  • o(n2)
  • o(s*n)
Q20 | You are given infinite coins of denominations 1, 3, 4. What is the minimum number of coins required to achieve a sum of 7?
  • 1
  • 2
  • 3
  • 4
Q21 | What is the space complexity of the divide and conquer algorithm used to find the maximum sub-array sum?
  • o(n)
  • o(1)
  • o(n!)
  • o(n2)
Q22 | Kadane’s algorithm is used to find
  • longest increasing subsequence
  • longest palindrome subsequence
  • maximum sub-array sum
  • longest decreasing subsequence
Q23 | Kadane’s algorithm uses which of the following techniques?
  • divide and conquer
  • dynamic programming
  • recursion
  • greedy algorithm
Q24 | For which of the following inputs would Kadane’s algorithm produce a WRONG output?
  • {1,0,-1}
  • {-1,-2,-3}
  • {1,2,3}
  • {0,0,0}
Q25 | What is the time complexity of Kadane’s algorithm?
  • o(1)
  • o(n)
  • o(n2)
  • o(5)