Bxbigboy7845 Bxbigboy7845
  • 19-07-2019
  • Computers and Technology
contestada

How many base cases are in the functionabove?

a. 0

b. 1

c. 2

d. 3

int func2(int m, int n) {

if (n == 0)

return 0;

else

return m + func2(m, n-1);

}

Respuesta :

ExieFansler ExieFansler
  • 23-07-2019

Answer:

The answer is (b). 1.

Explanation:

In the code there is only 1 base case .

the base case is as following:-

if(n==0)

return 0;

this is the base case.

Base case is the most important statement in the function that uses recursion because without base case the recursion calls will keep on going and we will get a run time error.

Answer Link

Otras preguntas

Determine whether the probabilities below are computed using the classical​ method, empirical​ method, or subjective method. On the basis of a survey of 1000 fa
Continental congress superintendent of finance 1781
{9} e {{9},{16}} true or false
Increase carbon dioxide emissions by 0.2 for each step forward for the rest of the scenario three
Three main ideas of the FFA mission statement a) Premier leadership b) Personal growth c) Career success d) All of the above
What four elements are important when wearing the uniform?
Soda lime absorbs how many liters of CO2 per 100 gm?a) 20-30 litersb) 30-40 litersc) 40-50 litersd) 50-60 liters
Kelsie works at a bicycle shop as a salesperson. She records the number of bicycles she sells on a daily basis. Here is the probability distribution of B= the n
Termination of an in-force insurance policy prior to the expiration date shown in the policy is known as A. Cancellation B. Non-renewal C. Reformation D. Rescis
TEMPER TANTRUMWhat should you do if a child you are babysitting has a temper tantrum?