C Skills Test: Trivia Quiz!

20 Questions | Total Attempts: 81

SettingsSettingsSettings
Please wait...
C Skills Test: Trivia Quiz!

.


Questions and Answers
  • 1. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> struct marks{ int p:3; int c:3; int m:2; }; int main(){ struct marks s={2,-6,5}; printf("%d %d %d",s.p,s.c,s.m); return 0; }
    • A. 

      2 -6 5

    • B. 

      2 -6 1

    • C. 

      2 2 1

    • D. 

      Compiler error

    • E. 

      None of these

  • 2. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int huge*p=(int huge*)0XC0563331; int huge*q=(int huge*)0xC2551341; *p=200; printf("%d",*q); return 0; }
    • A. 

      0

    • B. 

      Garbage value

    • C. 

      Null

    • D. 

      200

    • E. 

      Compiler error

  • 3. 
    What will be output if you will compile and execute the following c code? void main(){ if(printf("cquestionbank")) printf("I know c"); else printf("I know c++"); }
    • A. 

      I know c

    • B. 

      I know c++

    • C. 

      CquestionbankI know c

    • D. 

      CquestionbankI know c++

    • E. 

      Compiler error

  • 4. 
    What will be output if you will compile and execute the following c code? #define call(x) #x void main(){    printf("%s",call(c/c++)); }
    • A. 

      C

    • B. 

      C++

    • C. 

      #c/c++

    • D. 

      C/c++

    • E. 

      Compiler Error

  • 5. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i; float a=5.2; char *ptr; ptr=(char *)&a; for(i=0;i<=3;i++) printf("%d ",*ptr++); return 0; }
    • A. 

      0 0 0 0

    • B. 

      Garbage Garbage Garbage Garbage

    • C. 

      102 56 -80 32

    • D. 

      102 102 -90 64

    • E. 

      Compiler error

  • 6. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i; double a=5.2; char *ptr; ptr=(char *)&a; for(i=0;i<=7;i++) printf("%d ",*ptr++); return 0; }
    • A. 

      -51 -52 -52 -52 -52 -52 20 64

    • B. 

      51 52 52 52 52 52 20 64

    • C. 

      Eight garbage values

    • D. 

      Compiler error

    • E. 

      None of these

  • 7. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ printf("%s","c" "question" "bank"); return 0; }
    • A. 

      C question bank

    • B. 

      C

    • C. 

      Bank

    • D. 

      Cquestionbank

    • E. 

      Compiler error

  • 8. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ char *str="c-pointer"; printf("%*.*s",10,7,str); return 0; }
    • A. 

      C-pointer

    • B. 

      C-pointerc-pointer

    • C. 

      C-pointc-point

    • D. 

      Cpointer null null

    • E. 

      C-point

  • 9. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int a=-12; a=a>>3; printf("%d",a); return 0; }
    • A. 

      -4

    • B. 

      -3

    • C. 

      -2

    • D. 

      -96

    • E. 

      Compiler error

  • 10. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> #include <string.h> int main(){ printf("%d %d",sizeof("string"),strlen("string")); return 0; }
    • A. 

      6 6

    • B. 

      7 7

    • C. 

      6 7

    • D. 

      7 6

    • E. 

      None of these

  • 11. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ static main; int x; x=call(main); printf("%d ",x); return 0; } int call(int address){ address++; return address; }
    • A. 

      0

    • B. 

      1

    • C. 

      Garbage value

    • D. 

      Compiler error

    • E. 

      None of these

  • 12. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int a,b; a=1,3,15; b=(2,4,6); printf("%d ",a+b); return 0; }
    • A. 

      3

    • B. 

      21

    • C. 

      17

    • D. 

      7

    • E. 

      Compiler error

  • 13. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int extern x; int main() printf("%d",x); x=2; return 0; } int x=23;
    • A. 

      0

    • B. 

      2

    • C. 

      23

    • D. 

      Compiler error

    • E. 

      None of these

  • 14. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i=0; if(i==0){ i=((5,(i=3)),i=1); printf("%d",i); } Else printf("equal"); }
    • A. 

      5

    • B. 

      3

    • C. 

      1

    • D. 

      Equal

    • E. 

      None of above

  • 15. 
    What will be output if you will compile and execute the following c code? int main(){ int a=25; printf("%o %x",a,a); return 0; }
    • A. 

      25 25

    • B. 

      025 0x25

    • C. 

      12 42

    • D. 

      31 19

    • E. 

      None of these

  • 16. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> #define message "union is\ power of c" int main(){ printf("%s",message); return 0; }
    • A. 

      Union is power of c

    • B. 

      Union ispower of c

    • C. 

      Union is Power of c

    • D. 

      Compiler error

    • E. 

      None of these

  • 17. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i=10; static int x=i; if(x==i) printf("Equal"); else if(x>i) printf("Greater than"); else printf("Less than"); return 0; }
    • A. 

      Equal

    • B. 

      Greater than

    • C. 

      Less than

    • D. 

      Compiler error

    • E. 

      None of above

  • 18. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ printf("%s",__DATE__); return 0; }
    • A. 

      Current system date

    • B. 

      Current system date with time

    • C. 

      Null

    • D. 

      Compiler error

    • E. 

      None of these

  • 19. 
    What will be output if you will compile and execute the following c code? #include void start(); void end(); #pragma startup start #pragma exit end int static i; int main(){ printf("\nmain function: %d",++i); return 0; } void start(){ printf("\nstart function: %d",++i); } void end(){ printf("\nend function: %d",++i); }
    • A. 

      Main function: 2 start function: 1 end function:3

    • B. 

      Start function: 1 main function: 2 end function:3

    • C. 

      Main function: 2 end function:3 start function: 1

    • D. 

      Compiler error

    • E. 

      None of these

  • 20. 
    What will be output of the following c program? #include<stdio.h> int main(){ int goto=5; printf("%d",goto); return 0; }
    • A. 

      5

    • B. 

      **

    • C. 

      ****

    • D. 

      Compilation error

    • E. 

      None of these

    • F. 

      None of these