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

Under which condition does the method countDown terminate without issue?

Examine the recursive method countDown designed to print a countdown from the input number to zero by making recursive calls. Identify under what circumstance the countDown method will terminate without error.

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

Under which condition does the method countDown terminate without issue?

A

Only when the initial number is a non-negative integer

B

Only when the initial number is zero

C

Only when the initial number is a negative integer

D

For all integer inputs

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1singhris00011 0m 07s 93
#2upadhgau00002 0m 00s -20
#3ethan02 0m 00s -20
Items per page:
10
1 – 3 of 3
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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