Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 10: Recursion
Start Practice TestPractice Test
About Exam
easy Solved by 2 students

Recursive Method Termination

Mark
< Prev
Next >

Consider the findFactorial method below.

public int findFactorial(int n)
{
    if (n <= 1)
        return 1;
    else
        return n * findFactorial(n - 1);
}

For which integer values of n will the method terminate without error?

A

Only for input values greater than 1

B

Only when the input is a negative number

C

For any non-negative integer input

D

It will not terminate without error for any input

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|