Solved

Would Switching the Special Case Order Affect the Return Value

Question 33

Multiple Choice

Would switching the special case order affect the return value of the following method? public int mystery(int n, int m)
{
If (n == 0) // special case #1
{
Return 0;
}
If (n == 1) // special case #2
{
Return m;
}
Return m + mystery(n - 1, m) ;
}


A) No
B) Yes
C) It is impossible to tell.
D) An exception will be thrown.

Correct Answer:

verifed

Verified

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

Related Questions