If-Else Quiz
star
star
star
star
star
Last updated over 1 year ago
10 questions
1
What is output by the code below?int b = 100;if( b > 100) out.print("go");else if( b > 90) out.print("it");else out.print("up");out.print("on");
What is output by the code below?
int b = 100;
if( b > 100)
out.print("go");
else if( b > 90)
out.print("it");
else
out.print("up");
out.print("on");
1
What is output by the code below?int a = 75, b = 100;if( a > 90) if( b > 100) out.print("go"); else if( b > 90) out.print("it"); else out.print("up");out.print("on");
What is output by the code below?
int a = 75, b = 100;
if( a > 90)
if( b > 100)
out.print("go");
else if( b > 90)
out.print("it");
else
out.print("up");
out.print("on");
1
What is output by the code below?int a = 105, b = 120;if( a > 90) if( b > 100) out.print("go"); else if( b > 90) out.print("it"); else out.print("up");out.print("on");
What is output by the code below?
int a = 105, b = 120;
if( a > 90)
if( b > 100)
out.print("go");
else if( b > 90)
out.print("it");
else
out.print("up");
out.print("on");
1
What is output by the code below?int a = 105, b = 40;if( a > 90) if( b > 100) out.print("go"); else if( b > 90) out.print("it"); else out.print("up");out.print("on");
What is output by the code below?
int a = 105, b = 40;
if( a > 90)
if( b > 100)
out.print("go");
else if( b > 90)
out.print("it");
else
out.print("up");
out.print("on");
1
What values will be stored in c and d after execution of the following program segment?int c = 5, d = 10;if(d>c){ if(c > 50) c /= 2; else c = d-c; d = d/5;}else{ c = c/2; d = d/2+3;}
What values will be stored in c and d after execution of the following program segment?
int c = 5, d = 10;
if(d>c){
if(c > 50)
c /= 2;
else
c = d-c;
d = d/5;
}
else{
c = c/2;
d = d/2+3;
}
1
What values will be stored in c and d after execution of the following program segment?int c = 12, d = 3;if(d>c){ if(c > 50) c /= 2; else c = d-c; d = d/5;}else{ c = c/2; d = d/2+3;}
What values will be stored in c and d after execution of the following program segment?
int c = 12, d = 3;
if(d>c){
if(c > 50)
c /= 2;
else
c = d-c;
d = d/5;
}
else{
c = c/2;
d = d/2+3;
}
1
What is output by the code below?
int j = 11/2;switch(j){ case 5:j++;break; case 6:j++;break; case 7:j++;break;}System.out.println(j);
What is output by the code below?
int j = 11/2;
switch(j)
{
case 5:j++;break;
case 6:j++;break;
case 7:j++;break;
}
System.out.println(j);
1
What is output by the code below?int x= 11;switch( x ){ case 11 : System.out.print("it"); case 21 : System.out.print("go"); case 98 : System.out.print("up"); break;}
What is output by the code below?
int x= 11;
switch( x )
{
case 11 : System.out.print("it");
case 21 : System.out.print("go");
case 98 : System.out.print("up"); break;
}
1
What is output by the code below?
int b = 110;if( b > 100) out.print("go");else if( b > 90) out.print("it");else out.print("up");out.print("on");
What is output by the code below?
int b = 110;
if( b > 100)
out.print("go");
else if( b > 90)
out.print("it");
else
out.print("up");
out.print("on");
1
What is output by the code below?int b = -5;if( b > 100) out.print("go");else if( b > 90) out.print("it");else out.print("up");out.print("on");
What is output by the code below?
int b = -5;
if( b > 100)
out.print("go");
else if( b > 90)
out.print("it");
else
out.print("up");
out.print("on");