The following conditional expression is written in the C language. It is false when variable a is assigned either 10 or 20 and true otherwise.

!(a = = 10 a = = 20)

Which of the following conditional expressions is equivalent?

a) a != 10 II b !=20
b) a<=1011b>=20
c) a< 101Ia> 20
d) a = = 10 && a = = 20
e) a != 10 && a != 20
f) !(a = = 10) && !(a = = 20)

e) a != 10 && a != 20

Approach: Remove the not operator (!)
Flip applicable relational operators (= becomes != in two places) Flip applicable logical operators (II becomes &&)

Computer Science & Information Technology

You might also like to view...

The display screen attached to a PC should be located so a user looks ____.

A. up slightly B. straight ahead C. down slightly D. any of these

Computer Science & Information Technology

To remain efficient and competitive, retraining workers is an important activity for every high technology company.

Indicate whether the statement is true or false

Computer Science & Information Technology