JAVA Flow Control Which of the following for loops will be an infinite loop? for(i=0 ; i<1; i--) for(i=0; ; i++) All of these for(; ;) for(i=0 ; i<1; i--) for(i=0; ; i++) All of these for(; ;) 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=0, j=2; do{ i=++i; j--; }while(j>0); System.out.println(i); }} 2 1 0 None of these The program does not compile because of statement "i=++i;" 2 1 0 None of these The program does not compile because of statement "i=++i;" ANSWER DOWNLOAD EXAMIANS APP
JAVA Flow Control What will be the value of y after execution of switch statement?public class Test{ public static void main(String[] args){ int x = 3, y = 4; switch(x + 3){ case 6: y = 0; case 7: y = 1; default: y += 1; } }} 0 1 4 2 3 0 1 4 2 3 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); }} 9 11 None of these 10 20 9 11 None of these 10 20 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 7 NumberSeven NotSeven Error NumberSeven NotSeven 7 NumberSeven NotSeven Error ANSWER DOWNLOAD EXAMIANS APP
JAVA Flow Control Determine output:public class Test{ public static void main(String args[]){ int i; for(i = 1; i < 6; i++){ if(i > 3) continue ; } System.out.println(i); }} 6 5 3 2 4 6 5 3 2 4 ANSWER DOWNLOAD EXAMIANS APP