Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Increment/Decrement

Total questions: 6

Worksheet time: 6mins

Name
Class
Date
1.

int x=1, y = 2;

y = x++ ;

cout << x <<" "<< y ;

a)

3 1

b)

1 2

c)

2 1

d)

1 3

2.

int y, x=2;

y = ++x;

cout << x <<" "<< y ;

a)

1 2

b)

2 1

c)

2 2

d)

3 3

3.

int x = 2;

int y=4;

cout << x++ <<" "<< --y;

a)

1 2

b)

2 3

c)

2 4

d)

2 1

4.

int x= 2;

int y = 2 * x++;

cout << x <<" "<< y;

a)

3 4

b)

3 3

c)

4 3

d)

4 4

5.

int x= 99;

if (x++ < 100)

cout << "It is true!\n";

else

cout << "It is false!\n";

a)

It is false!

b)

It is true!

6.

int x=0;

if (++x)

cout << "It is true!\n";

else

cout << "It is false!\n";

a)

It is true!

b)

It is false!