Log in
Sign up for FREE
arrow_back
Library
Ifs Quiz
By Mickey Arnold
star
star
star
star
star
Share
share
Last updated almost 2 years ago
10 questions
Add this activity
1
1
1
1
1
1
1
1
1
1
Question 1
1.
What is the output?
int x = 40;
if( x >= 20 )
out.print("1");
out.print("2");
13
123
12
1
23
Question 2
2.
What is the output?
int a = 40;
if(a>=20)
out.print("1");
if(a>=50)
out.print("2");
out.print("3");
23
12
123
13
3
Question 3
3.
What is the output?
int a = 40;
if(a>=20)
out.print("1");
out.print("2");
123
13
12
3
23
Question 4
4.
What is the output?
int a = 40;
if(a>=50)
out.print("1");
if(a>=40)
out.print("2");
out.print("3");
12
3
23
123
13
Question 5
5.
What is the output?
int a = 40;
if(a>=50)
{
out.print("1");
}
out.print("2");
1
12
123
2
3
Question 6
6.
What is returned by the call
go(2)
?
public static String go( int a )
{
if(a>=0)
{
return "1";
}
return "2";
}
1
3
2
12
13
Question 7
7.
What is returned by the call
go(9)
?
public static int go( int a )
{
int ans = 0;
if(a>=0)
{
ans += 1;
}
ans += 2;
return ans;
}
4
3
2
1
6
Question 8
8.
What is returned by the call
go(-3)
?
public static String go( int a )
{
if(a>=0)
{
return "1";
}
return "2";
}
1
3
12
13
2
Question 9
9.
What is returned by the call
go(0)
?
public static int go( int a )
{
int ans = 0;
if(a>=0)
{
ans += 1;
}
ans += 2;
return ans;
}
3
4
1
2
6
Question 10
10.
What is returned by the call
go(-9)
?
public static int go( int a )
{
int ans = 0;
if(a>=0)
{
ans += 1;
}
ans += 2;
return ans;
}
1
3
4
6
2