wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Operators in Java

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

Write the java expression for the following

ax5+bx3+c

(a)  

2.

Give the output of the following , when m = 10, n =6

m - = 9 % ++n + ++n/2

(a)  

3.

What is the value of y if x = 5

y = ++x - x++ + --x

(a)  

4.

  Write the java expression fora2+b\sqrt{a^2+b} 



(a)  

5.

What will be the value x if a = , b =

x = ( a > b ) ? a : b

(a)  

6.

Rewrite the following code using ternary operator


int c ;

if( a > b )

c = a;

else

c = b;

(a)  

7.

Evaluate if a = 10 , b = 8

a % b++

(a)  

8.

What is the output of the following

char x = 'A' ;

int m ;

m = ( x== 'a') ? 'A' : 'a' ;

(a)  

9.

What will be the value of m if m = 8

m *= 8

(a)  

10.

Write the output of the following


( 4 > 7 ) || ( 7 < 15 )

a)

true

b)

false