Font size
S
M
L
XL
WorksheetsJava Operator
Total questions: 10
Worksheet time: 5mins
Name
Class
Date
1.
What would the new value of A be?
A=1;
a++;
a)
1
b)
2
c)
3
d)
4
2.
What would the new value of A be?
A=1;
A--;
a)
0
b)
1
c)
2
d)
-1
3.
What's the value of below?
int i=5;
System.out.println(i);
System.out.println(++i);
a)
6
7
b)
67
c)
7
8
d)
5
6
4.
What does the following code output?
int x = 1;
System.out.println(x++);
a)
1
b)
2
c)
compilation error
d)
runtime error
5.
Which statement(s) are equivalent to i = i + 1?
a)
i += 1
b)
i++
c)
i -= 1
d)
i--
6.
What symbol represents the and operator in Java?
a)
AND
b)
and
c)
&
d)
&&
7.
What symbol represents the or operator in Java?
a)
OR
b)
or
c)
||
d)
|
8.
Which one of the following is NOT a logical operator?
a)
||
b)
&&
c)
$$
d)
!
9.
If a=2, b=5, c=3
Find result for : 8 * (a + b + c) – a % c
a)
80
b)
81
c)
77
d)
78
10.
int a = 2, b = 2, c = 0;
double d = 30.1;
Find answer for = (a > b) &&(( c <d) || (c!=a))
a)
35.9
b)
80
c)
true
d)
false
Reset
