Are the following Boolean expressions true or false? Assume variables x = 5 and y = 6.
!(x > 6) _________ (x==6 && x==5) _________ (x==6 || x==5) _________ (x>-1 && y<10) _________Although the syntax is correct, what is flawed about the following Boolean expression?
(x > 10 && x < 5) ________________________________Answers:
!(x > 6) true (x==6 && x==5) false (x==6 || x==5) true (x>-1 && y<10) true
(x > 10 && x < 5)The above can never be true! A number can never be greater than ten AND less than five.









Wait, so how can x==6 || x==5 be true if x=5? I got the others right. Is this meaning that in some cases 5 == 6?
Comment by Gabe — October 20, 2009 @ 9:46 pm
Ah, I got it now. Thanks anywho.
Comment by gabriel mathews — October 21, 2009 @ 8:50 am
I have the same question, how can x==6?
Comment by Emily — January 26, 2010 @ 3:17 pm
x does not equal 6, x equals five. However, in the following expression:
the || represents an “or” meaning if x is equal to 6 OR x is equal to 5. And it is equal to 5. so the entire expression is true.
In the case of an AND:
since x cannot be both 6 and 5 at the same time, that expression is clearly false.
Comment by Daniel Shiffman — January 26, 2010 @ 6:50 pm