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

What are regular and irregular reflection of light? plz help its urgent..​
ACTIVIDAD: lea atentamente,La tecnologia ha evolucionado a pasos agigantados, y si bien es cierto que ha traído consigo innumerablesaspectos positivos, también
There are 2 gallons for every 8 quarts. If there are 12 quarts, how many gallons are there?
fill in the blanks with b,a,g,e create a simple melodyg _ _ _ _ _b _ _ _ _ _g _ _ _ _ _a _ _ _ _ _Pls answer itthank yiu​
Solve the Antiderivative.​
What is the volume of this figure? 8 in. 2 1/7 in. i6 1/4 in.
Order these numbers by least to greatest 3.2, 2.1281, 3.208, 3.28
Explain the purpose of insurance. If a mother purchases health insurance for her and her four (4) children, who is the policyholder, and who is (are) the benefi
Determine if Ordered pairs are Solutions: -8x - 14y = 28 2x - 7y = 14
Compare and contrast Natural Law and Law of Nature.​