NEW
Font size
WorksheetsJava Basic Day-2
Total questions: 10
Worksheet time: 5mins
which of the following is a legal identifier in java?
2variable
#myvar
+@$var
$_myvar
which of these is NOT a valid keyword or reserved word in java?
default
null
String
volatile
which is the legal range of values fro a short?
-128 to +127
-255 to 255
-32768 to 32767
0 to 65535
which declaration of the main() method is valid?
public void main(String args[])
public void static main(String args[])
final public static void main(String []arr)
public static void main(String []arr)
Is 3*4 equivalent to 3 << 2 ?
Yes
NO
what will be the output?
public class Test
{
public static void main(String[] args) {
double d=100.04;
float f=d;
System.out.println(""+f);
}
}
100.04
100.0
100
Compilation Error
Which Operator will always evaluate all the operands ?
||
&&
?:
%
Which of these is long data type literal?
0x99fffL
ABCDEFG
0x99fffa
99671246
Which of these can not be used for a variable name in Java?
identifier
keyword
identifier & keyword
none of the mentioned
What will be the error in the following Java code?
byte b = 50;
b = b * 50;
b cannot contain value 100, limited by its range
* operator has converted b * 50 into int, which can not be converted to byte without casting
b cannot contain value 50
No error in this code
