Which of the following conditions does not test whether x is

Which of the following conditions does not test whether x is between 1 and 10 (inclusive)?

A) 1<=x && x<=10

B) !(x<1 || 10<x)

C) !(x<=1 || x>=10)

D) 10>= x && x>=1

E) !(x>10) && !(x<1)

Solution

Which of the following conditions does not test whether x is between 1 and 10 (inclusive)? (option c is the answer)

C) !(x<=1 || x>=10)

Option C doesn\'t check whether x is between 1 and 10. It returns false when x is either 1 or 10

Suppose x is 1, the expression will be

!(1<=1 || 1>=10)

=>!(T || F)

=>!(T) => F

same is the case with x=10


!(10<=1 || 10>=10)

=>!(F || T)

=>!(T) => F

Which of the following conditions does not test whether x is between 1 and 10 (inclusive)? A) 1<=x && x<=10 B) !(x<1 || 10<x) C) !(x<=1 |

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site