Recursive Method Tracing
Consider the following processNumber method.
public static void processNumber(int n) {
if (n <= 1) {
System.out.print(n);
} else {
processNumber(n - 2);
System.out.print(n % 2);
}
}
What is printed to the console as a result of the call processNumber(5)?
A
101
B
111
C
100
D
001
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | ajcantuwilson0325 | 1 | 1 | 2m 12s | -32 |
| #2 | tellabhinaya | 0 | 1 | 1m 31s | -101 |
| #3 | singhris000 | 1 | 1 | 3m 49s | -129 |
Items per page:
10
1 – 3 of 3
APFIVE