Programming in C - Constants, Variables and Data Types

31. If integer needs two bytes of storage, then maximum value of a signed integer is

  • Option : B
  • Explanation :
    In signed magnitude form, one bit is dedicated to store the sign. (e.g.. 1 for negative and 0. otherwise). Only the remaining 15 bits arc available to store the magnitude. Hence the answer.
Cancel reply
Cancel reply

32. printf ( "%d" , printf ( "tim" ) ):

  • Option : B
  • Explanation :
    Any function (including main ( ) ) , returns a value to the calling environment. In the case of printf, it is the number of characters it printed. So. the output will be tim3 (since it printed the three characters a, b, c).
Cancel reply
Cancel reply

33. If abc is the input, then the following program fragment
char x, y, z ;
printf ("% d" , scanf ("%c%c%c" , &x , &y , &z )) ;
results in

  • Option : D
  • Explanation :
    Take reference from below.
    Any function (including main ( ) ) , returns a value to the calling environment. In the case of printf, it is the number of characters it printed. So. the output will be tim3 (since it printed the three characters a, b, c).
    The scanf function returns the number of successful matches. i.e., 3 in this case.
Cancel reply
Cancel reply

34. Consider the statements

  • Option : B
  • Explanation :
    The input is actually a \ n b. Since we are reading only two characters, only a and \ will be read and printed.
Cancel reply
Cancel reply

35. Literal means

Cancel reply
Cancel reply