WorksheetsJava Quiz-2
Total questions: 15
Worksheet time: 18mins
What is the output of the following code?
40, 30
40, 40
30, 40
30, 30
What is the output of the following code?
15, 25
15, 15
25, 15
25, 25
What is the output of the following code?
12.0, 12.0
15.0, 12
Compile Error
15.0, 15.0
Which one will NOT compile?
byte b1; byte b2;
int K, int L;
short s1, s2, s3 = 5;
long L1 = 4, L2, L3 = 7;
If one value is int and the other is decimal, java will automatically promote int to the decimal point value's data type
True
False
What will be the data type for x / y?
short
byte
int
long
What is the data type of x / y * z?
long
double
float
short
If the operator is placed after the value (n++), this case first original value will be used before the increase
True
False
What is the output of the given code?
2
3
4
5
What is the output of the given code?
-4
6
-6
4
What is the output of the given code?
1
0
Compile Time Error
Null Pointer error
What is the output of the given code?
1
5
4
Compile-Time Error
Which expression can be used to test if String s is not equal to String t?
s != t
s.!equals(t)
!s.equals(t)
none of the above
We use == sign to compare
Primitives
String (object)
The string is one of the primitive data types in java.
True
False
