πŸ“Š Design and Analysis of Algorithms
Q. Which of the following methods can be used to find the sum of digits of a number?
  • (A) recursion
  • (B) iteration
  • (C) greedy algorithm
  • (D) both recursion and iteration
πŸ’¬ Discuss
βœ… Correct Answer: (D) both recursion and iteration

Explanation: both recursion and iteration can be used to find the sum of digits of a number.

πŸ“Š Design and Analysis of Algorithms
Q. What can be the maximum sum of digits for a 4 digit number?
  • (A) 1
  • (B) 16
  • (C) 36
  • (D) 26
πŸ’¬ Discuss
βœ… Correct Answer: (C) 36

Explanation: the sum of digits will be maximum when all the digits are 9. thus, the sum will be maximum for the number 9999, which is 36.

πŸ“Š Design and Analysis of Algorithms
Q. What can be the minimum sum of digits for a 4 digit number?
  • (A) 0
  • (B) 1
  • (C) 16
  • (D) 36
πŸ’¬ Discuss
βœ… Correct Answer: (B) 1

Explanation: the sum of digits will be minimum for the number 1000 and the sum is 1.

πŸ“Š Design and Analysis of Algorithms
Q. What is the time complexity of the above code used to reverse a string?
  • (A) copies a string to another string
  • (B) compares two strings
  • (C) reverses a string
  • (D) checks if a string is a palindrome
πŸ’¬ Discuss
βœ… Correct Answer: (D) checks if a string is a palindrome

Explanation: the main purpose of the above code is to check if a string is a palindrome.

πŸ“Š Design and Analysis of Algorithms
Q. What is the time complexity of the above recursive implementation used to reverse a string?
  • (A) o(1)
  • (B) o(n)
  • (C) o(n2)
  • (D) o(n3)
πŸ’¬ Discuss
βœ… Correct Answer: (B) o(n)

Explanation: the time complexity of the above recursive implementation used to

πŸ“Š Design and Analysis of Algorithms
Q. What is the time complexity of matrix multiplied recursively by Divide and Conquer Method?
  • (A) o(n)
  • (B) o(n2)
  • (C) o(n3)
  • (D) o(n!)
πŸ’¬ Discuss
βœ… Correct Answer: (C) o(n3)

Explanation: the time complexity of recursive multiplication of two square matrices by the divide and conquer method is found to be o(n3) since there are total of 8 recursive calls.

πŸ“Š Design and Analysis of Algorithms
Q. How many recursive calls are there in Recursive matrix multiplication by Strassen’s Method?
  • (A) 5
  • (B) 7
  • (C) 8
  • (D) 4
πŸ’¬ Discuss
βœ… Correct Answer: (B) 7

Explanation: for the multiplication two square matrix recursively using strassen’s method, there are 7 recursive calls performed for high time complexity.

πŸ“Š Design and Analysis of Algorithms
Q. Matrix A is of order 3*4 and Matrix B is of order 4*5. How many elements will be there in a matrix A*B multiplied recursively.
  • (A) 12
  • (B) 15
  • (C) 16
  • (D) 20
πŸ’¬ Discuss
βœ… Correct Answer: (B) 15

Explanation: the resultant matrix will be of order 3*5 when multiplied recursively and therefore the matrix will have 3*5=15 elements.

πŸ“Š Design and Analysis of Algorithms
Q. If Matrix X is of order A*B and Matrix Y is of order C*D, and B=C then the order of the Matrix X*Y is A*D?
  • (A) true
  • (B) false
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (A) true

Explanation: given that b=c, so the two matrix can be recursively multiplied.

Jump to