| preferred AP College board partner for AP classes
AP Computer Science A/Unit 10: Recursion
Start Practice TestPractice Test
About Exam
easy Solved by 1 students
Recursive Method Termination
< 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

For any non-negative integer input

B

Only for input values greater than 1

C

Only when the input is a negative number

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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy