C Programming MCQ

1:

What does the statement,
printf("%d",10?0?5:1:12);
prints :

A.

10

B.

5

C.

12

D.

1

 

Answer : D

Explanation :

It will print '1' as  : operator states that either  first or second condition true.

jagadeesh said: (6:27pm on Tuesday 30th May 2017)
here the statement is false when 0 and true in remaining all cases the logic in the question can be rewritten as 10?(0?5:1):12 here 10 is true so 0?5:1 is executed and 0 is false so 1 is returned

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.