C Programming Hardest Trivia Questions Test! Quiz

37 Questions | Total Attempts: 69

SettingsSettingsSettings
Please wait...
C Programming Hardest Trivia Questions Test! Quiz

This quiz is the C Programming Hardest Trivia Questions Test that programming students should have a try and tackle before they sit for their certification exams. Do you feel like you have what it takes to tackle it based on what you have learnt so far? How about you give it a try and see how well you will do?


Questions and Answers
  • 1. 
    What statement can print \n on screen?
    • A. 

      Printf("\\n");

    • B. 

      Printf("n\")

    • C. 

      Printf('\\n')

    • D. 

      Printf("\n")

  • 2. 
    Address stored in the pointer variable is of type?
    • A. 

      Int

    • B. 

      Float 

    • C. 

      Array

    • D. 

      String

  • 3. 
    What is the output of the following code
    • A. 

      11 11 11

    • B. 

      Compile time error

    • C. 

      Segmentation  fault/code trash

    • D. 

      12 12 undefined value

  • 4. 
    What will be printed? int a = 15;  int b = 0;  b = (a % 7);    printf("\n\n%i\n", b);
    • A. 

      0

    • B. 

      1

    • C. 

      7

    • D. 

      15

  • 5. 
    Which header file should be included to use functions like malloc() and calloc()?
    • A. 

      Dos.h

    • B. 

      Alloc.h

    • C. 

      Stdlib.h

    • D. 

      Memory.h

  • 6. 
    The operators . , !! , < , = if arranged in ascending order of precedence reads?
    • A. 

      .,!!,<,=

    • B. 

      =,<,!!,.

    • C. 

      =,!!,<,.

    • D. 

      <,!!,=,.

  • 7. 
    How many tokens are there in the following?       if(csi==100);
    • A. 

      6

    • B. 

      7

    • C. 

      5

    • D. 

      4

  • 8. 
    Which one of the four equations will be correct? given interchanges: signs "-" and "*" , numbers 3 and 6. 
    • A. 

      6-3*2=9

    • B. 

      6*3-4=15

    • C. 

      3-6*8=10

    • D. 

      3*6-4=33

  • 9. 
     What is the output of this C code?   void main() {     int i, j;     for(i=0,j=0;i<10,j<20;i++,j++){         printf("i=%d \t j=%d\n", i, j);     } }
    • A. 

      Print i and j till 19

    • B. 

      Print i till 9 and j till 19

    • C. 

      Print i and j till 9

    • D. 

      Runtime error

  • 10. 
    What gets printed? printf("%d\n",4 ?:8);
    • A. 

      8

    • B. 

      4

    • C. 

      Null

    • D. 

      Compiler error

  • 11. 
    What is the output of this C code? #include int main() {     int y = 2;     int z = y +(y = 10);     printf("%d\n", z); }
    • A. 

      2

    • B. 

      4

    • C. 

      20

    • D. 

      Compile time error

  • 12. 
    C programming:the given expression P-=Q+1 is same as
    • A. 

      P=P-Q-1

    • B. 

      P=P-Q+1

    • C. 

      P=-P+Q+1

    • D. 

      NONE

  • 13. 
    Which keyword is used for coming out of recursion?
    • A. 

      Break 

    • B. 

      Return

    • C. 

      Exit

    • D. 

      All the above

    • E. 

      Continue

  • 14. 
    Which of the following does not represent a valid storage class in C?
    • A. 

      Static

    • B. 

      Union

    • C. 

      Extern

    • D. 

      Automatic

  • 15. 
    How many times is Hello world printed ?   int main() {     fork();     fork();     printf("Hello world\n"); }
    • A. 

      1

    • B. 

      2

    • C. 

      4

    • D. 

      8

  • 16. 
    Which of the following cannot be static in C?
    • A. 

      Variables 

    • B. 

      Structures

    • C. 

      Functions

    • D. 

      None

  • 17. 
    According to ANSI specifications which is the correct way of declaring main when it receives command-line arguments?
    • A. 

      Int main(int argc,char *argv[])

    • B. 

      Int main(){int argc ; char *argv);

    • C. 

      None

    • D. 

      Int main {argc,argv)int argc; char *argv;

  • 18. 
    Char *s[10] defines an array of ___________
    • A. 

      None

    • B. 

      String to pointer 

    • C. 

      Pointers to strings

    • D. 

      Both pointers to string and strings to pointers

  • 19. 
    Which of the following is not a standard C Library?
    • A. 

      Errno.h

    • B. 

      Setjmp.h

    • C. 

      Signal.h

    • D. 

      Retarg.h

  • 20. 
    A pointer in a C which has not been initialized is know as
    • A. 

      Far pointer

    • B. 

      Void pointer

    • C. 

      Null pointer

    • D. 

      Wild pointer

  • 21. 
    What is the output of the following 
    • A. 

      Yes 

    • B. 

      No

    • C. 

      Compile time error

    • D. 

      Yes no

  • 22. 
    What will be x in the following c code? #include void main() {  int x; }
    • A. 

      Automatic variable

    • B. 

      Static variable

    • C. 

      Registered variable

    • D. 

      Global variable

  • 23. 
    How will you free the allocated memory?
    • A. 

      Delete(var-name);

    • B. 

      Free(var-name);

    • C. 

      Remove(var-name)

    • D. 

      Dealloc(var-name);

  • 24. 
    What is the output of the following?   #include int main() {     char ch;     if(ch = printf(""))         printf("It matters\n");     else         printf("It doesn't matters\n");     return 0; }
    • A. 

       It matters

    • B. 

      It doesn’t matters

    • C. 

       Run time error

    • D. 

      Nothing

  • 25. 
    When fopen() is not able to open a file, then it returns
    • A. 

      Compiler dependent

    • B. 

      Runtime error

    • C. 

      EOF

    • D. 

      NULL