McqMate

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 |

Answer» D. both recursion and iteration | |

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

847

0

Do you find this helpful?

5

View all MCQs in

Design and Analysis of AlgorithmsNo comments yet

- You are given n dice each having f faces. You have to find the number of ways in which a sum of S can be achieved. This is the dice throw problem. Which of the following methods can be used to solve the dice throw problem?
- What can be the maximum sum of digits for a 4 digit number?
- What can be the minimum sum of digits for a 4 digit number?
- 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
- 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?
- Given a 2D matrix, find a submatrix that has the maximum sum. Which of the following methods can be used to solve this problem?
- Given an array, check if the array can be divided into two subsets such that the sum of elements of the two subsets is equal. This is the balanced partition problem. Which of the following methods can be used to solve the balanced partition problem?
- Which of the following methods can be used to find the largest and smallest number in a linked list?
- Which of the following methods can be used to find the nth Catalan number?
- Given a string, you have to find the minimum number of characters to be inserted in the string so that the string becomes a palindrome. Which of the following methods can be used to solve the problem?