SET-5
1.if(true && false && true || false)
System.out.println("True.");
else
System.out.println("False");
A.True.
B.False.
2.public class temp
{
public static void main(String args[])
{
int ok=10;
switch(ok)
{
default:
System.out.println("default");
case 0:
System.out.println("true");
case 1:
System.out.println("false");
}
}
}
A.default
B.Error
C.true false default
D.default true false
3.public class temp
{
public static void main(String args[])
{
int x=1;
if((boolean)x==true)
System.out.println("True.");
else
System.out.println("False.");
}
}
A.True.
B.False.
C.Error
4.public class temp
{
public static void main(String args[])
{
int x=1;
if(x)
System.out.println("True");
else
System.out.println("False");
}
}
A.True
B.False
C.Error
5.public class temp
{
public static void main(String args[])
{
boolean ok=true;
switch(ok)
{
case true:
System.out.println("true");
break;
case false:
System.out.println("false");
break;
default:
System.out.println("default");
break;
}
}
}
A.Error
B.true
C.false
D.default
6.double x = 6.2;
if(x-- >= 6.0)
System.out.print("first ");
if(--x >= 5.0)
System.out.print("second ");
if(x-- >= 4.0)
System.out.print("third ");
else
System.out.print("fourth ");
A.first second third
B.first second fourth
C.first fourth
D.first third
7.public class temp
{
public static void main(String args[])
{
int x=10;
System.out.println(
((x=5)?"yes":"no") );
}
}
A.yes
B.no
C.Error
8.public class temp
{
public static void main(String agrs[])
{
int x=10;
switch(x)
{
case 5:
x+= 5;
case 10:
x+=10;
case 15:
x+=15;
case 20:
x+=20;
}
System.out.println(x);
}
}
A.55
B.45
C.20
D.10
9.After compilation of a Java program which code generated?
A.Executable code (.exe)
B.Assembly code (.asm)
C.Object Code (.obj)
D.Byte Code (.class)
10.Which company started developing Java (as a Green Project)?
A.Microsoft
B.Oracle
C.Apple
D.Sun Microsystem
No comments:
Post a Comment