Programming Language Java Control Flow Question #2147
Single Choice Not Set

QWhat 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);
		  }
	    }
      }
}

ID: #2147 Java Control Flow 1,904 views
Question Info
#2147Q ID
Not SetDifficulty
Java Control FlowTopic

Choose the Best Option

Click any option to instantly check if you're correct.

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

Explanation

Repeatedly print 1 2 3 and cause infinite loop.

Share This Question

Challenge a friend or share with your study group.

Related MCQ Questions