Practice · 1 of 4
Exam MCQ
CHALLENGE
Difficulty: advanced+25 XP
What is printed? (Watch for the dead variable.)
``java
int total = 0;
int spare = 0;
int[] a = {2, 5, 1};
for (int v : a) {
total += v;
spare += v * 2;
}
spare = 0;
System.out.print(total + "," + spare);
`
A. 8,16
B. 8,0
C. 0,16
D. 16,0`
Print the letter, then your one-sentence justification.
Press Submit to check your solution.
Back to lesson: Practice: Exam #2: MCQ section