C Programming MCQ

1:

The following program fragment

int i = 107, x = 5;
printf  (( x  > 7) ? " %d " : "%c", i ) ;


results in

A.

an execution error

B.

a syntax error

C.

printing of k

D.

none of the above

 

Answer : C

Explanation :

Since x > 7 is false, the ternary operator?: returns "%c". So, print f ( "%c " ,  i) will be executed. So, the ASCII character corresponding to 107, i.e., ' k ' will be printed.

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.