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

Recursive String Method Output

Mark
< Prev
Next >

Consider the following recursive method. What is printed as a result of the call processString(input)?

public void processString(String input) 
{
 if (input.length() > 0)
 {
 System.out.print(input.substring(0, 1) + input.substring(0, 1));
 processString(input.substring(1));
 }
}
A

It removes every second character in input.

B

It duplicates each character in input.

C

It prints input in reverse order, duplicating each character.

D

It prints the first character of input twice.

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.

AI Tutor

How can I help?

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