C Programming and Problem Solving Questions and Answers 171 to 180

C Programming and Problem Solving

Questions 171 to 180

 171 If  a=Oxaa and   b=a<<1 then (a)  b=2a       (b)  b=a/2            (c)  a=b-1          (d)  b=a-1          (e)  b=a. 172 Which of the following operator(s) has/have right to left associativity? (a)  ++          (b)  – –                (c)  +=  (d)  Both (a) and (b) above         (e)  All (a), (b) and (c) above. 173 With the following declaration , the correct answer is enum rgb{red=-1, green, blue}; (a)   red= -1   green= -2   blue= -3 (b)   red= -1   green= 1     blue= 2 (c)   red= -1   green= 0     blue= 1 (d)   red= -1   green= 2     blue= 3 (e)   All the above alternatives are illegal declarations. 174 What is the return value of the following function if the function is called as int value = fun(10);              int fun(int n)        {               if( n = = 1 ||  n = =  2)  return 0;                    else   return( n-1 + fun(n-2) );        } (a)  20    (b)  26     (c)  22           (d)  24   (e)  0. 175 Which of the following is not a key word in ‘C’? (a)  void (b)  getchar     (c)  sizeof         (d)  short           (e)  volatile. 176 Consider the following code:        struct account {                      int acno;        }svar, *pv = &svar;        then the acno can be accessed by (a)  svar.acno       (b)  pv->acno            (c)  (*pv).acno   (d)  a & b & c    (e)  (a) & (b) only. 177 Trace out the correct outcome of the following program: void fun(char *s1, char *s2)        {               while(*s2)    *s1++ = *s2++;               *s1 = ‘\0’;        }        void main()        {               char s2[]= “lion”,  s1[] = “monkey”;               fun(s2, s1);               puts(s2);        }      (a)  lion  (b)  lion monkey         (c)  monkey  (d)  null        (e)  Syntax error. 178 While working with the binary streams for ‘C’ I/O file operations (a)   Only the binary values can be read and can be written (b)   No Character translation takes place (c)   Character translation takes place (d)   Number of characters written (read) are not same as the number that is stored on the external device (e)   Both (a) and (b) above. 179 The function islower (char) checks whether a character is in lower case or not and hence it should return (a)   The character in lower case (b)   The character itself (c)   Nothing (d)   -1, 0, or 1 (e)   0 or 1. 180 The function sprintf( ) works like printf( ), but operates on (a)  strings    (b)  data in a file               (c)  stderr          (d)  stdin (e)  standard output device.