• 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
How many times will the following code print "Welcome to Examveda"?int count = 0;do { System.out.println("Welcome to Examveda"); count++;} while (count < 10);

11
0
8
9
10

ANSWER DOWNLOAD EXAMIANS APP

JAVA Flow Control
What is the value of a[1] after the following code is executed?int[] a = {0, 2, 4, 1, 3};for(int i = 0; i < a.length; i++) a[i] = a[(a[i] + 3) % a.length];

1
4
0
3
2

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

3
0
4
2
1

ANSWER DOWNLOAD EXAMIANS APP

JAVA Flow Control
What will be the output of the following program?public class Test{ public static void main(String args[]){ int i = 0, j = 5 ; for( ; (i < 3) && (j++ < 10) ; i++ ){ System.out.print(" " + i + " " + j ); } System.out.print(" " + i + " " + j ); }}

0 6 1 7 2 8 3 8
0 6 1 5 2 5 3 5
0 6 1 7 2 8 3 9
Compilation Error

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

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

ANSWER DOWNLOAD EXAMIANS APP

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

for(i=0 ; i<1; i--)
for(i=0; ; i++)
for(; ;)
All 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
↑