| preferred AP College board partner for AP classes
AP Computer Science A/Unit 10: Recursion
Start Practice TestPractice Test
About Exam
easy Solved by 3 students
Recursive Factorial Method Output
< Prev
Next >

Consider the following fact method.

public static int fact(int n) {
    if (n <= 1) return 1;
    return n * fact(n - 1);
}

What value is returned by the call fact(5)?

A

120

B

24

C

Compilation Error

D

5

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