Programming Basics Of C Language - Quiz 1 ( 6-7 June 2018 )

30 Questions | Total Attempts: 288

SettingsSettingsSettings
Programming Quizzes & Trivia

Dear Student, The Quiz consists of General MCQ on C Programming Language. Total 30 Questions Time Allocated : 20 Minutes. Happy Learning ! Team SHIVAM


Questions and Answers
  • 1. 
    The return-type of “printf” is:
    • A. 

      Void

    • B. 

      Float

    • C. 

      Int

    • D. 

      Char

  • 2. 
    The token ‘sizeof’ is
    • A. 

      Operator

    • B. 

      Function

    • C. 

      Structure

    • D. 

      Modifier

  • 3. 
    The function that calls itself is referred to as:
    • A. 

      Iterative

    • B. 

      Recursive

    • C. 

      Nested

    • D. 

      None of the above

  • 4. 
    The following escape sequence represents a carriage return:
    • A. 

      “\n”

    • B. 

      “\r”

    • C. 

      “\t”

    • D. 

      “\b”

  • 5. 
    The conversion character corresponding to long integer is
    • A. 

      “%u”

    • B. 

      “%i”

    • C. 

      “%d”

    • D. 

      “%ld”

  • 6. 
    Linking during compilation means to connect:
    • A. 

      User defined function header

    • B. 

      User defined function code

    • C. 

      Library function code

    • D. 

      Library function header

  • 7. 
    ‘enum’ is a
    • A. 

      Basic datatype

    • B. 

      Derived datatype

    • C. 

      User defined datatype

    • D. 

      Modifier

  • 8. 
    The maximum size of the member is the size of which of the following token
    • A. 

      structure

    • B. 

      Union

    • C. 

      Class

    • D. 

      Enumeration

  • 9. 
    In Pre-processor is taken into consideration by the compiler during
    • A. 

      Pre-compilation

    • B. 

      Compilation

    • C. 

      Linking

    • D. 

      Execution

  • 10. 
    In procedure oriented programming , the emphasis is on:
    • A. 

      Structure

    • B. 

      Data

    • C. 

      object

    • D. 

      function

  • 11. 
    Which of the following is not a valid variable name declaration?
    • A. 

      Int _a3;

    • B. 

      Int a_3;

    • C. 

      Int 3_a;

    • D. 

      Int _3a

  • 12. 
    Variable name resolving (number of significant characters for uniqueness of variable) depends on
    • A. 

      Compiler and linker implementations

    • B. 

      Assemblers and loaders implementations

    • C. 

      C language

    • D. 

      None of these

  • 13. 
    Which is valid C expression?
    • A. 

      Int my_num = 100,000;

    • B. 

      Int my_num = 100000;

    • C. 

      Int my num = 1000;

    • D. 

      Int $my_num = 10000;

  • 14. 
    What will happen if the below program is executed? #include int main() { int main = 3; printf("%d", main); return 0; }
    • A. 

      Compile-time error

    • B. 

      run-time error

    • C. 

      Prints 3

    • D. 

      Halt after the “printf” statement

  • 15. 
    Which of the following cannot be a variable name in C?
    • A. 

      Volatile

    • B. 

      True

    • C. 

      Friend

    • D. 

      Export

  • 16. 
    Comment on the output of this C code? #include int main() { float f1 = 0.1; if (f1 == 0.1) printf("equal\n"); else printf("not equal\n"); return 0; }
    • A. 

      Equal

    • B. 

      Not equal

    • C. 

      Output depends on compiler

    • D. 

      Code will not compile

  • 17. 
    Comment on the output of this C code? #include int main() { int a[5] = {1, 2, 3, 4, 5}; int i; for (i = 0; i < 5; i++) if ((char)a[i] == '5') printf("%d\n", a[i]); else printf("FAIL\n"); return 0; }
    • A. 

      The compiler will flag an error

    • B. 

      Program will compile and print 5

    • C. 

      Program will print the ASCII value of 5

    • D. 

      Program will print FAIL for 5 times

  • 18. 
    What is the output of this C code (on a 32-bit compiler)? #include int main() { int x = 10000; double y = 56; int *p = &x; double *q = &y; printf("p and q are %d and %d", sizeof(p), sizeof(q)); return 0; }
    • A. 

      P and q are 4 and 4

    • B. 

      P and q are 4 and 8

    • C. 

      Compiler error

    • D. 

      p and q are 2 and 8

  • 19. 
    What is the output of the following C code(on a 64 bit machine)? #include union Sti { int nu; char m; }; int main() { union Sti s; printf("%d", sizeof(s)); return 0; }
    • A. 

      8

    • B. 

      5

    • C. 

      9

    • D. 

      4

  • 20. 
    What is the output of this C code? #include int main() { float x = 'a'; printf("%f", x); return 0; }
    • A. 

      A

    • B. 

      Run time error

    • C. 

      A.0000000

    • D. 

      97.000000

  • 21. 
    What is the output of this program? void main() { int a=b=c=10; a=b=c=50; printf(“\n %d %d %d”,a,b,c); }
    • A. 

      50 50 50

    • B. 

      Compile Time Error

    • C. 

      10 10 10

    • D. 

      Three Garbage Values

  • 22. 
    By default a function returns a value of type
    • A. 

      Int

    • B. 

      Char

    • C. 

      Void

    • D. 

      None of these

  • 23. 
    Which is not keyword in ‘C’ ?
    • A. 

      Typedef

    • B. 

      Const

    • C. 

      Near

    • D. 

      Complex

  • 24. 
    Which is valid string function?
    • A. 

      Strpbrk

    • B. 

      Strlen

    • C. 

      Strxfrm

    • D. 

      Strcut

  • 25. 
    What will be output if you will compile and execute the following c code? #include "stdio.h" #include "string.h" void main() { int i=0; for(;i
    • A. 

      0 1 2

    • B. 

      0 1 2 3

    • C. 

      1 2 3

    • D. 

      Compilation error

    • E. 

      Infinite loop

Back to Top Back to top