Solutions!!
1. Which of the following are valid Java
a)
Identifiers? Choose all that apply.
i
a) i d)abc12
b) 1tax 3
g) sum_of_array
c)java_&_point
h) TESTVARIABLE
d) abc123
e) sum and difference
f) My Variable
g) sum_of_array
h) TESTVARIABLE
j) 1_age
k) sum&difference
2. What will be the output of this
code? int x = 3;
int y =
10
10; int a
= y; y =
x;
x = a;
System.out.print(x);
3. Evaluate this logical expression:
! false || ! true
true
4. Evaluate this expression: 1 + 1 <= 4 && 16 - 5 > 10 False
5. Which of the following are NOT Java b
primitive data types? Choose all that apply. )
a) boole c
an l
1/
19
, CSE 205- Midterm Exam Latest Update With Complete
Solutions!!
ass b) class
c)float d) S
d)String tring
e)Rando
m
i)Array
j)Math
2/
19
, CSE 205- Midterm Exam Latest Update With Complete
Solutions!!
e) Rando
m f)int
g)double
h)char
i)Array
j)Math
6. Which of the following Java literals have the a)123.0 f)-
data type double? Choose all that apply. 3
a) 123.0 g)123
b) "true" k)-
c) 'a' 1.23
d)3f
e)fals
e f)-3
g)123
h)1.23
f
i)true j)"3.0"
k)-1.23
l) '\n'
7. When the following expression is evaluated, the result int
will be what Java data
type? 61 + 66
a) int
b) float
c)double
d) boolean
e) char
3/
19