Solved

Consider the Following Definition of the Recursive Function Mystery \quad Return 0;
Else If (First == Last)

Question 28

Multiple Choice

Consider the following definition of the recursive function mystery. int mystery(int first,int last)
{
if (first > last)
\quad Return 0;
else if (first == last)
\quad Return first;
else
\quad return first + mystery(first + 1,last - 1) ;
}
What is the output of the following statement?
cout << mystery(6,10) << endl;


A) 13
B) 21
C) 40
D) 42

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