| preferred AP College board partner for AP classes
AP Computer Science A/Unit 10: Recursion
Start Practice TestPractice Test
About Exam
medium Solved by 6 students
Recursive Method With A For Loop
< Prev
Next >

Consider the following method.

public static void loopRecursion(int n) {
    if(n <= 0) return;
    for(int i = 0; i < n; i++){
        System.out.print(i);
    }
    loopRecursion(n - 1);
}

What is printed to the console as a result of the call loopRecursion(3)?

A

0120

B

012012

C

01210

D

012010

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
#1tykenjcruz11 0m 00s 100
#2singhris00011 0m 49s 51
#3richa.tuli01 2m 54s -184
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: apfive@apfive.org|Privacy Policy