JAVA Flow Control What will be the result?1. int i = 10;2. while(i++ <= 10){3. i++;4. }5. System.out.print(i); 10 Line 5 will be never reached. 11 12 13 10 Line 5 will be never reached. 11 12 13 ANSWER DOWNLOAD EXAMIANS APP
JAVA Flow Control Consider the following program written in Java.class Test{ public static void main(String args[]){ int x=7; if(x==2); // Note the semicolon System.out.println("NumberSeven"); System.out.println("NotSeven"); }}What would the output of the program be? NumberSeven NotSeven NumberSeven 7 Error NotSeven NumberSeven NotSeven NumberSeven 7 Error NotSeven ANSWER DOWNLOAD EXAMIANS APP
JAVA Flow Control Determine output:public class Test{ public static void main(String args[]){ int i, j; for(i=1, j=0;i<10;i++) j += i; System.out.println(i); }} 11 9 10 20 None of these 11 9 10 20 None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Flow Control What all gets printed when the following program is compiled and run.public class Test{ public static void main(String args[]){ int i, j=1; i = (j>1)?2:1; switch(i){ case 0: System.out.println(0); break; case 1: System.out.println(1); case 2: System.out.println(2); break; case 3: System.out.println(3); break; } }} 2 1 2 3 1 0 2 1 2 3 1 0 ANSWER DOWNLOAD EXAMIANS APP
JAVA Flow Control What will be the output?public class Test{ public static void main(String[] args){ int x=10, y=0; if(x && y){ System.out.print("TRUE"); } else{ System.out.print("FALSE"); } }} Runtime Error FALSE Compilation Error TRUE Runtime Error FALSE Compilation Error TRUE ANSWER DOWNLOAD EXAMIANS APP
JAVA Flow Control 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); } } }} 1 2 3 1 Compilation fails because of line 2 Repeatedly print 1 2 3 and cause infinite loop. 1 2 3 2 None of these 1 2 3 1 Compilation fails because of line 2 Repeatedly print 1 2 3 and cause infinite loop. 1 2 3 2 None of these ANSWER DOWNLOAD EXAMIANS APP