ICSE Class 10 Computer Applications
20 Questions Based on Increment(++) and Decrement(--) Operators
What is the final value of the variable `result` in the following expressions?
1.
int a = 5, b = 3, c = 7;
int result = (++a * b--) + (c++ / (--a + b));
2.
int x = 3, y = 5, z = 7;
int result = (--x * (y++ + z--)) - (++y / (x-- + z++));
3.
int m = 4, n = 6, p = 8, q = 10;
int result = ((m++ * n--) - (--p / q++) + (++m)) * (--n + p--);
4.
int a = 2, b = 4, c = 6, d = 8;
int result = (++a * (b-- + --c)) + ((d++ / --a) - (++b / c--));
5.
int x = 5, y = 3, z = 7, w = 10;
int result = (--x + (y++ * z--) - (++w / (x++ + --y) * (z++ / w--)));
6.
int a = 4, b = 7, c = 3, d = 5;
int result = (++a * (b++ - --c) + (--d / (a-- + b--) * (c++ / d--)));
7.
int x = 3, y = 6, z = 2, w = 8;
int result = ((--x * y++) - (++z / w--) + (x++ * (--y + z--))) * (++w);
8.
int m = 5, n = 8, p = 10, q = 3;
int result = ((m++ * n--) + (--p / q++) - (++m) * (n++ / --p));
9.
int a = 6, b = 2, c = 4, d = 8;
int result = (++a * (b-- + --c) - (--d / (a++ + b++) * (c++ / d--)));
10.
int x = 3, y = 7, z = 5, w = 2;
int result = (--x + (y++ * z--) - (++w / (x++ + --y) * (z++ / w--)));
11.
int m = 4, n = 6, p = 2, q = 8;
int result = ((m++ * n--) + (--p / q++) - (++m) * (n++ / --p));
12.
int a = 5, b = 3, c = 7, d = 2;
int result = (--a * (b++ - --c) + (--d / (a-- + b--) * (c++ / d--)));
13.
int x = 3, y = 6, z = 4, w = 8;
int result = ((--x * y++) - (++z / w--) + (x++ * (--y + z--))) * (++w);
14.
int m = 5, n = 8, p = 3, q = 10;
int result = ((m++ * n--) + (--p / q++) - (++m) * (n++ / --p));
15.
int a = 6, b = 2, c = 8, d = 4;
int result = (++a * (b-- + --c) - (--d / (a++ + b++) * (c++ / d--)));
16.
int x = 3, y = 7, z = 5, w = 2;
int result = (--x + (y++ * z--) - (++w / (x++ + --y) * (z++ / w--)));
17.
int m = 4, n = 6, p = 2, q = 8;
int result = ((m++ * n--) + (--p / q++) - (++m) * (n++ / --p));
18.
int a = 5, b = 3, c = 7, d = 2;
int result = (--a * (b++ - --c) + (--d / (a-- + b--) * (c++ / d--)));
19.
int x = 3, y = 6, z = 4, w = 8;
int result = ((--x * y++) - (++z / w--) + (x++ * (--y + z--))) * (++w);
20.
int m = 5, n = 8, p = 3, q = 10;
int result = ((m++ * n--) + (--p / q++) - (++m) * (n++ / --p));
Comments
Post a Comment