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

Which compound is formed from a network of bonded ions?
Which answer is a correctly punctuated compound sentence? a. this book was very long; i liked it anyway. b. this book was very long, i liked it anyway. c. th
The sum of two numbers is 35. Three times the larger number is the same as 4 times the smaller number. Find the larger number
I need answers 1-12...
What 2 numbers make add 73 and subracts to 23?
What is another name for the molecular orbital theory of bonding in metals?A.band theoryB.ionic bond theoryC.covalent bond theoryD.electron bond theory
Is as i lay dying what is anse most preoccupied with
the Great Lakes in North American hold about what percent of Earth's fresh surface water? 5% 10% 15% 20%
new viewpoints and ideas are valuable to companies because it allows them to
Which passage from Kennedy’s inaugural address is an example of anaphora? “To those people in the huts and villages of half the globe struggling to break the bo