What is y after the following statement is executed?

x = 0;
y = (x > 0) ? 10 : -10;
a. -10
b. 0
c. 10
d. 20
e. Illegal expression

a This conditional operator is correct. It assigns -10 to y since x > 0 is false.

Computer Science & Information Technology

You might also like to view...

In the absence of a user-written assignment operator, the C++ compiler builds a memberwise assignment operator as the default assignment operator for each class.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

UTP cable has foil shielding.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology