Given the code fragment:
int j = 0, k = 0;
for (int i = 0; i < x;
i++) {
do {
k = 0;
while (k < z)
{
k++;
System.out.print(k + " ");
}
System.out.println(" ");
j++;
} while (j < y);
System.out.println("----");
}
What values of
x, y, z will produce the following result?
1 2 3 4
1 2 3 4
1 2 3 4
——
1 2 3 4
——
1 2 3 4
1 2 3 4
1 2 3 4
——
1 2 3 4
——
A.
X = 4, Y = 3, Z = 2
X = 4, Y = 3, Z = 2
B.
X = 3, Y = 2, Z = 3
X = 3, Y = 2, Z = 3
C.
X = 2, Y = 3, Z = 3
X = 2, Y = 3, Z = 3
D.
X = 4, Y = 2, Z = 3
X = 4, Y = 2, Z = 3
E.
X = 2, Y = 3, Z = 4
X = 2, Y = 3, Z = 4
Risposta: E
int x=2;
int y=3;
int z=4;
Nessun commento:
Posta un commento