Vidyalelo
Java Programming · Q42

Flow Control

Programming · Java Programming · question 42

Q42

What will be the result of the following code? public class Test static public void main(String args[]) //line 2 int i, j; for(i=0; i<3; i++) for(j=1; j<4; j++) i%=j; System.out.println(j);

A.
1 2 3 1
B.
1 2 3 2
C.
Repeatedly print 1 2 3 and cause infinite loop.
Answer
D.
Compilation fails because of line 2
E.
None of these

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board