82.0k views
1 vote
!((x > y) && (y <= 0)) is equivalent to which of the following expressions?

1. !(x > y) && !(y <= 0)
2. (x <= y) || (y > 0)
3. (x < y) || (y > 0)

I only
II only
III only
I and III only
II and III only

User Fvox
by
3.1k points

1 Answer

4 votes

Answer:

II only

is the correct answer.

Step-by-step explanation:

Given is:

!((x > y) && (y <= 0))

This statement says that neither the variable x is greater than the variable y nor the variable y is smaller than or equal to the number 0.

So by simplifying the NOT operator, it will be splited as:

!(x > y) || !(y <= 0)

This means that:

  • x is not greater than y so => (x<=y)
  • y is not smaller than or equal to 0 so => (y>0)

So the expression will become:

(x <= y) || (y > 0)

It means the same as the given clause that:

the variable x is smaller than and equal to variable y or the variable y is greater than the number 0.

I hope it will help you!

User Dongryphon
by
3.3k points