Chapter 04: Operators and Expressions in Java

1.	Predict the result of the following statement in java. 
int m=8;
m*=8;
System.out.print(m);
a)	16
b)	8
c)	64
d)	88

2.	The statement n++ can be also expressed as:
a)	n+1
b)	n=n+1
c)	++n
d)	None of these

3.	Which of the following is the correct java expression for the statement y= 2(lb + bh + lh)
a)	y = 2*l*b*b*h*l*h
b)	y = 2*l*b + b*h + l*h
c)	y = 2*(lb + bh + lh)
d)	y = 2*(l*b + b*h + l*h)

4.	What is the binary equivalent of (45)10?
a)	(101010)2
b)	(100101)2
c)	(110011)2
d)	(101101)2

5.	Find the value of a++ when int a= -1
a)	0
b)	-1
c)	1
d)	None

6.	If a=0, b=1; then a OR b =?
a)	0
b)	1
c)	Both (a) and (b)
d)	Neither (a) nor (b)

7.	Which of the following has the lowest precedence among the following: &&, %, ++, >=
a)	>=
b)	++
c)	&&
d)	%

8.	Determine the output of ‘a’ and ‘b’ 
int a=10, b=0;
b= ++a;
a)	10,11
b)	10,10
c)	11,10
d)	11,11

9.	double c=0.0; 
int x= 5, y= 10, z=11;
c= x*y + z/2
a)	55
b)	55.0
c)	55.5
d)	None

10.	What is the value of ‘c’ when c = a % b, if a= 43 and b= 5?
a)	0
b)	8.0
c)	8.6
d)	None of these

11.	int m=5, p=0;
p= ++m + --m;
What is the value stored in ‘p’?
a)	12
b)	9
c)	11
d)	10

12.	 int a=2, p=0;
p= ++a - a++ +a;
System.out.println(p);
Find the output.
a)	4
b)	0
c)	3
d)	2