Log in
Sign up for FREE
arrow_back
Library

Ifs Quiz

star
star
star
star
star
Last updated about 2 years ago
10 questions
1
1
1
1
1
1
1
1
1
1
Question 1
1.

Question 2
2.

Question 3
3.

Question 4
4.

Question 5
5.

Question 6
6.

Question 7
7.

Question 8
8.

Question 9
9.

Question 10
10.

What is the output?
int x = 40;
if( x >= 20 )
out.print("1");
out.print("2");
13
123
12
1
23
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
What is the output?
int a = 40;
if(a>=20)
out.print("1");
out.print("2");
123
13
12
3
23
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
What is the output?
int a = 40;
if(a>=50)
{
out.print("1");
}
out.print("2");
1
12
123
2
3
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
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
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
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
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