• HOME
  • QUIZ
  • CONTACT US
EXAMIANS
  • COMPUTER
  • CURRENT AFFAIRS
  • ENGINEERING
    • Chemical Engineering
    • Civil Engineering
    • Computer Engineering
    • Electrical Engineering
    • Mechanical Engineering
  • ENGLISH GRAMMAR
  • GK
  • GUJARATI MCQ

JAVA Flow Control

JAVA Flow Control
Which of the following for loops will be an infinite loop?

All of these
for(i=0 ; i<1; i--)
for(; ;)
for(i=0; ; i++)

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

None of these
1 2 3 1
1 2 3 2
Repeatedly print 1 2 3 and cause infinite loop.
Compilation fails because of line 2

ANSWER DOWNLOAD EXAMIANS APP

JAVA Flow Control
What will be the output?public class Test{ public static void main(String args[]){ int i = 1; do{ i--; }while(i > 2); System.out.println(i); }}

None of these
2
1
0
-1

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
0
1 2
3

ANSWER DOWNLOAD EXAMIANS APP

JAVA Flow Control
What will be the result?1. int i = 10;2. while(i++ <= 10){3. i++;4. }5. System.out.print(i);

11
Line 5 will be never reached.
10
12
13

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
20
10
9
None of these

ANSWER DOWNLOAD EXAMIANS APP
MORE MCQ ON JAVA Flow Control

DOWNLOAD APP

  • APPLE
    from app store
  • ANDROID
    from play store

SEARCH

LOGIN HERE


  • GOOGLE

FIND US

  • 1.70K
    FOLLOW US
  • EXAMIANSSTUDY FOR YOUR DREAMS.
  • SUPPORT :SUPPORT EMAIL ACCOUNT : examians@yahoo.com

OTHER WEBSITES

  • GUJARATI MCQ
  • ACCOUNTIANS

QUICK LINKS

  • HOME
  • QUIZ
  • PRIVACY POLICY
  • DISCLAIMER
  • TERMS & CONDITIONS
  • CONTACT US
↑