1.
Q1: What is printed as a result of executing the following code segment?
int k = 0;
while (k < 10) {
System.out.print((k % 3) + " ");
if ((k % 3) == 0)
k = k + 2;
else
k++;
}
- 0 2 1 0 2
- 0 2 0 2 0 2
- 0 2 1 0 2 1 0
- 0 2 0 2 0 2 0
- 0 1 2 1 2 1 2