Solved

Consider the Code for the Recursive Method MysteryPrint Shown in This

Question 44

Multiple Choice

Consider the code for the recursive method mysteryPrint shown in this code snippet: public static int mysteryPrint(int n)
{
If (n == 0)
{
Return 0;
}
Else
{
Return (n + mysteryPrint(n-1) ) ;
}
}
What will be printed with a call to mysteryPrint(-4) ?


A) 0
B) -10
C) -22
D) Nothing - a StackoverflowError exception will occur

Correct Answer:

verifed

Verified

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

Related Questions