Solved

Would Switching the Special Case Order Affect the Return Value

Question 39

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

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents