220k views
1 vote
Suppose the value of b is false and the value of x is 0. What is the value of each of the following expressions? a. b && x = = 0 b. b || x = = 0 c. !b && x = = 0 d. !b || x = = 0 e. b && x != 0

User Patonza
by
3.8k points

1 Answer

2 votes

Answer:

a. False

b. True

c. True

d. True

e. False

Explanation:

You want to know the truth value of various logical expressions when b = False, and x = 0.

And, Or

An And (&&) expression is true if and only if all parts are true. An OR (||) expression is true if any part is true.

When 'b' is false, b&&__ will be false, and !b||__ will be true. This makes (a) and (e) false, and (d) true.

When x = 0, __||x==0 will be true, so (b) is true.

The And (&&) of expression (c) will only be true when both parts are true. For b = False and x = 0, both parts are true, so (c) is true.

{a, b, c, d, e} = {False, True, True, True, False}

Suppose the value of b is false and the value of x is 0. What is the value of each-example-1
User Danroose
by
3.3k points