124k views
1 vote
Assume that a and b have been defined and initialized as int values. The expression

!(!(a != b ) && (b > 7))

is equivalent to which of the following?

(A) (a != b) || (b < 7)
(B) (a != b) || (b <= 7)
(C) (a == b) || (b <= 7)
(D) (a != b) && (b <= 7)
(E) (a == b) && (b <= 7)

User JuanF
by
7.8k points

1 Answer

1 vote

Final answer:

To find the equivalent expression for !(!(a != b) && (b > 7)), apply De Morgan's laws and negation properties. The correct equivalent expression is (a == b) || (b <= 7), which corresponds to answer choice (C).

Step-by-step explanation:

The original student question asks which expression is equivalent to the given logical statement !(!(a != b) && (b > 7)). To find the equivalent expression, we should apply De Morgan's laws and the definition of negation. First, let's simplify the inner negation:

!(a != b) is equivalent to (a == b), since the negation of not equal is equal.

Applying this negation we get:

!((a == b) && (b > 7))

Now, we need to apply De Morgan's law to distribute the negation:

!(a == b) || !(b > 7), which simplifies to (a != b) || (b <= 7) because the negation of equal is not equal and the negation of greater than is less than or equal.

The expression equivalent to the original statement is thus:

(a == b) || (b <= 7)

So the correct answer is (C) (a == b) || (b <= 7).

User Gcarvelli
by
7.9k points