solution for Chapter 2, Problem 9Q of problem solving and programming concepts 9th edition, thanks
Expert Answer
Find the result of the following operations:
a. 5 + 4 simple arithmetic addition =9
b. 10/2 division =5
c. True OR False OR returns true if either of the operands are true hence this returns TRUE
d. 20 MOD 3 MOD returns remainder therefore this returns 2
e. 5 < 8 returns TRUE
f. 25 MOD 70 returns 25
g. “A” > “H” returns false
h. NOT True negation is written as NOT, hence this returns FALSE.
i. 2570 returns 0 if the caller is an integer
j. False AND True AND returns false if one of the operands is false therefore this returns FALSE
k. 20 * 0.5 returns 10
l. 35 <= 35 returns true
m. 35/7 depending on the caller, this could be 5 or 5.0(for float)
n. False OR False since both operands are false, this returns FALSE
o. True AND True since both operands are True, this returns True
p. 50 MOD 5 returns remainder i.e. 0
q. -35 < 67 explained below
r. 4.0 ^ 3 ^ is used for XOR, and it is not defined for float,
s. 609 returns 6.66 if assigned to float or 6 if assigned to integer
t. 35 < 35 returns false
u. True AND False since one of the operand is false, this returns false
SInce you have only asked answer for the q part,i assume then you must have solved the others.
q. -35<67, this expression here is no different to e i.e 5<8. the only difference being this has a negative numeric type.
which is treated as a normal integer with its standard mathematical meaning,
here is a number line view…
-infinity……… -35……0……67….+infinity.
hence the above expression will return true.(boolean data type)
this can be used like if(-35<67) then or
boolean a= -35<67;
Hope this was clear, let me know in comments if it was not,
Thanks
Good day.