CP I/O Q15

0. The following program fragment
int i = 107, x = 5;
printf (( x > 7) ? " %d " : "%c", i ) ;
results in

  • Option : 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.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *