Evalute the following expressions A 3 4 15 3 B 2 15 3
Evalute the following expressions.
A. 3 * 4 == 15 - 3
B. 2 - 15 / 3 >= 7 - 4
C. \'D\' >= \'f\'
D. \'t\' <= \'s\'
e. \'#\' <= \'*\'
f. 8.5 / 2 - 1.3 < 4.0 * 0.7 + 1.2
suppose that x, y, and z are int variables and x = 12, y = 34, and z = 18.
Determine whether the following expressions evaluate to true of false,
a. !(x - y >=1 )
b. z <= 7 || y < 12
c. (x + y != 40) && (x != z)
d. (z - x >= y ) || ( y - x != z + 4)
e, (5 - x <= 2 * y) && (y - 15 >= z ) ||( x- 5 != y - 2 * z)
Suppose that x, y, z and w are int variables and x = 25, y = 3, z = 12 and w = 4. What is the output of the following statements?
a. cout << \"x == z: \" << ( x == z ) << endl,
b. cout << \"y != z - 9: \" << (y != z - 9 ) << endl;
c. cout << \"x - y == z + 10: \" << (x - y == z + 10 << endl;
d . cout << \"! (z < w ) :\" << ! (z < w ) << endl;
e. cout << \"w - y < x - 2 * z: \" << ( w - y < x - 2 * z) << endl;
Can you solve and explain for me step by step, because I do not understand very well the exclamation mark ( ! ).
And on the first I do not know if its to say true or false or to solve it as math.
Thank you
Solution
(A)
3 * 4 == 15 - 3
12==12
we know that this is correct statement
so, answer is TRUE
(b)
2 - 15 / 3 >= 7 - 4
2-5>=3
-3>=3
We can see that this statment is not correct
so, Answer is FALSE
(C)
\'D\' >= \'f\'
firstky , we find ascii values of these characters
ascii value of \'D\' is 68
ascii value of \'f\' is 102
68>=102
we can see that this statement is not correct
so, answer is FALSE
(D)
\'t\' <= \'s\'
ascii value of \'t\' is 116
ascii value of \'s\' is 115
116<=115
we can see that this statement is incorrect
so, answer is FALSE

