wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

operators(part-1)

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

int x = 5;

int y = 6

int z = 50;

System.out.println(x + y + z);


What will be the output?

a)

61

b)

5650

c)

66

d)

x + y + z

2.

What is the output of below code?


int x = 5;

System.out.println(x++);

System.out.println(x);

a)

5

5

b)

6

6

c)

5

6

d)

6

5

3.

What would the new value of A be?

A=1;

a++;

a)

1

b)

2

c)

3

d)

4

4.

What would the new value of A be?

A=1;

A--;

a)

0

b)

1

c)

2

d)

-1

5.

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

6.

Which statement(s) are equivalent to i = i + 1?

a)

i += 1

b)

i++

c)

i -= 1

d)

i--

7.

What does the following code output?

int x = 1;

System.out.println(x++);

a)

1

b)

2

c)

compilation error

d)

runtime error

8.

++ increases the value of a variable by 1

a)

assignment operator

b)

decrement operator

c)

increment operator

d)

sentinel

9.

What would the new value of A be?

A=1;

a++;

a)

1

b)

2

c)

3

d)

4

10.

Which statement(s) are equivalent to i = i + 1?

a)

i += 1

b)

i++

c)

i -= 1

d)

i--