Computer Science
Given three Boolean variables a, b, c as : a = False, b = True, c = False. Evaluate the following Boolean expressions:
(a) b and c
(b) b or c
(c) not a and b
(d) (a and b) or not c
(e) not b and not (a or c)
(f) not ((not b or not a) and c) or a
Answer
(a) b and c
⇒ False and True
⇒ False
(b) b or c
⇒ True or False
⇒ True
(c) not a and b
⇒ not False and True
⇒ True and True
⇒ True
(d) (a and b) or not c
⇒ (False and True) or not False
⇒ False or not False
⇒ False or True
⇒ True
(e) not b and not (a or c)
⇒ not True and not (False or False)
⇒ not True and not False
⇒ False and True
⇒ False
(f) not ((not b or not a) and c) or a
⇒ not ((not True or not False) and False) or False
⇒ not ((False or True) and False) or False
⇒ not (True and False) or False
⇒ not False or False
⇒ True or False
⇒ True
Related Questions
What would following code fragments result in? Given x = 3.
(a) 1 < x
(b) x >= 4
(c) x == 3
(d) x == 3.0
(e) "Hello" == "Hello"
(f) "Hello" > "hello"
(g) 4/2 == 2.0
(h) 4/2 == 2
(i) x < 7 and 4 > 5.
Write following expressions in Python:
What are augmented assignment operators? How are they useful?
Differentiate between (555/222)**2 and (555.0/222)**2.