QUESTION IMAGE
Question
closed - book, closed - note, closed - person.
- list all the comparison/relational operators. hint: there are more than 4.
- complete the following truth tables for the boolean logic operators:
| x | not x | |
| false | ||
| true | ||
| x | y | x and y |
| false | false | |
| false | true | |
| true | false | |
| true | true | |
| x | y | x or y |
| false | false | |
| false | true | |
| true | false | |
| true | true |
for question 3, assume:
a = 3.5
b = 10
10 is not 0
- evaluate the following expressions:
i) a > b or b!= 0 → true
ii) not (b < a) and a <= 3.5 → false
b 10 is not less than 3.5
continued on back...
Step1: List comparison/relational operators
The common comparison/relational operators are: == (equal to), != (not equal to), < (less than), > (greater than), <= (less than or equal to), >= (greater than or equal to).
Step2: Complete 'not' truth - table
The 'not' operator negates the boolean value. So when x = False, not x = True; when x = True, not x = False.
Step3: Complete 'and' truth - table
The 'and' operator returns True only when both operands are True. So:
False and False = FalseFalse and True = FalseTrue and False = FalseTrue and True = True
Step4: Complete 'or' truth - table
The 'or' operator returns True if at least one of the operands is True. So:
False or False = FalseFalse or True = TrueTrue or False = TrueTrue or True = True
Step5: Evaluate expressions
i)
Given a = 3.5 and b = 10, a > b is False and b != 0 is True. In an 'or' operation, if one of the operands is True, the result is True. So a > b or b != 0 is True.
ii)
b < a is False, so not (b < a) is True. And a <= 3.5 is True since a = 3.5. In an 'and' operation, both operands must be True for the result to be True. So not (b < a) and a <= 3.5 is True.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
==,!=,<,>,<=,>=
2.
| x | not x |
|---|---|
| True | False |
| x | y | x and y |
|---|---|---|
| False | True | False |
| True | False | False |
| True | True | True |
| x | y | x or y |
|---|---|---|
| False | True | True |
| True | False | True |
| True | True | True |
3.
i) True
ii) True