wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz - 5 on Increment and Decrement Operators

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the value of x after the following code is executed?

int x = 5;

x++;

a)
4
b)
5
c)
6
d)
7
2.

What is the value of y after the following code is executed?

int y = 10;

y--;

a)
8
b)
9
c)
10
d)
11
3.

What is the value of z after the following code is executed?

int z = 3;

int a = z++;

a)
2
b)
3
c)
4
d)
5
4.
What is the final value of b in the following code? int a = 5; int b = ++a;
a)
4
b)
5
c)
6
d)
7
5.
What is the output of the following code? int x = 2; int y = x++ + 5; printf("%d", y);
a)
6
b)
7
c)
8
d)
9
6.
What is the result of the following code? int a = 4; int b = --a + 3;
a)
5
b)
6
c)
7
d)
8
7.
After executing the following code, what is the value of c? int a = 7; int b = a--; int c = b + a;
a)
12
b)
13
c)
14
d)
15
8.
What is the value of x after the following code is executed? int x = 1; x = x++ + --x;
a)
1
b)
2
c)
3
d)
4
9.
What is the value of y after the following code is executed? int x = 5; int y = ++x + x--;
a)
10
b)
11
c)
12
d)
13
10.
What is the value of z after the following code is executed? int x = 3; int y = 4; int z = x++ + ++y;
a)
6
b)
7
c)
8
d)
9
11.
What is the final value of a after the following code is executed? int a = 3; int b = 2; a = b++ + ++b;
a)
4
b)
5
c)
6
d)
7
12.
What is the output of the following code?int x = 5; int y = ++x + x++ + --x; printf("%d", y);
a)
16
b)
17
c)
18
d)
19
13.
What is the result of the following code? int a = 8; int b = a++ - --a + a;
a)
7
b)
8
c)
9
d)
10
14.
After executing the following code, what is the value of b? int a = 6; int b = a-- - --a + ++a;
a)
5
b)
6
c)
7
d)
8
15.
What is the value of x after the following code is executed? int x = 1; int y = x++ + x++ + x;
a)
3
b)
4
c)
5
d)
6