Programming In C MCQs Set-7

PropellerAds
  1. 1. Comment on the output of following code:1. #include 2. main() 3. { 4. char *p = 0; 5. *p = ‘a’; 6. printf(“value in pointer p is %c\n”, *p); 7. }
    • It will print a
    • It will print 0
    • Compile time error
    • Run time error
  2. 2. Which of the following is a keyword used for a storage class?
    • Printf
    • externa
    • auto
    • scanf
  3. 3. The prototype of the function in the header file isA]Stdio.h
    • stdlib.h
    • conio.h
    •  io.h
    • Stdio.h
  4. 4. Preprocessor Directives are used for –
    • Macro Expansion
    • File Inclusion
    • Conditional Compilation
    • All of these
  5. 5. Which function is used to read character as you type ?
    • getchar()
    • getch()
    • getche()
    • Both (B) and (C
  6. 6. Which format specifier is used to print the values of double type variable
    • %If
    • %Id
    • %Iu
    • %f
  7. 7. What will be the output of the following program? Void main( ) { Int x []= {10,20,30,40,50}; Print f (“ \n %d %d %d %d “, x [4] ,3[x] ,x[2] ,1[x] ,x[0] ); }
    • Error
    • 10 20 30 40 50
    • 50 40 30 20 10
    • None of these
  8. 8. Which of the following is not s keyword of ‘C’ ?
    • auto
    • register
    • int
    • function
  9. 9. What will be the output ? #define SQUARE(X) X * X void main ( ) { printf (“\n Square = %d” , SQUARE(10+2) ); }
    • Square = 144
    • Square =32
    • Square =122
    • Square =12
  10. 10. By default a function returns a value of type
    • int
    • char
    • void
    • None of these