Solved

Consider the Following Recursive Sum Method

Question 31

True/False

Consider the following recursive sum method:
public int sum(int x)
{
if (x == 0) return 0;
else return sum(x - 1) + 1;
}
If the base case is replaced with if (x == 1) return 1; the method will still compute the same thing.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions