B and C I think is true.. A I don't know..

The Gateway to Computer Science Excellence

0 votes

Suppose a, b, c and d are int variables. For ternary operator in C ( ? : ), pick the best statement.

**(A)** a>b ? : ; is valid statement i.e. 2nd and 3rd operands can be empty and they are implicitly replaced with non-zero value at run-time.

**(B)** a>b ? c=10 : d=10; is valid statement. Based on the value of a and b, either c or d gets assigned the value of 10.

**(C)** a>b ? (c=10,d=20) : (c=20,d=10); is valid statement. Based on the value of a and b, either c=10,d=20 gets executed or c=20,d=10 gets executed.

**(D)** All of the above are valid statements for ternary operator.

52,217 questions

59,907 answers

201,102 comments

118,146 users