Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 2 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

012010

B

012012

C

01210

D

0120

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total 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|FAQ