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 1 students

Recursive Method Termination

Mark
< Prev
Next >

Consider the following recursive method.

public void countDown(int n) {
  if (n >= 0) {
    System.out.println(n);
    countDown(n - 1);
  }
}

Under which condition will the countDown method terminate without causing an error?

A

For all integer inputs

B

Only when the initial number is zero

C

Only when the initial number is a non-negative integer

D

Only when the initial number is a negative integer

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1singhris00011 0m 07s 93
#2upadhgau00002 0m 00s -20
#3ethan02 0m 00s -20
Items per page:
10
1 – 3 of 3

AI Tutor

How can I help?

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