And Answers
Which of the following are valid Java Identifiers? Choose all that apply.
a) i
b) 1tax
c) java_&_point
d) abc123
e) sum and difference
f) My Variable
g) sum_of_array
h) TESTVARIABLE
j) 1_age
k) sum&difference ANS a) i
d)abc123
g)sum_of_array
h) TESTVARIABLE
What will be the output of this code?
int x = 3;
int y = 10;
int a = y;
y = x;
x = a;
System.out.print(x); ANS 10
Evaluate this logical expression:
! false || ! true ANS true
Evaluate this expression: 1 + 1 <= 4 && 16 - 5 > 10 ANS False
, Which of the following are NOT Java primitive data types? Choose all that apply.
a)boolean
b)class
c)float
d)String
e)Random
f)int
g)double
h)char
i)Array
j)Math ANS b) class
d) String
e)Random
i)Array
j)Math
Which of the following Java literals have the data type double? Choose all that apply.
a)123.0
b)"true"
c)'a'
d)3f
e)false
f)-3
g)123
h)1.23f
i)true
j)"3.0"
k)-1.23
l)'\n' ANS a)123.0
f)-3