C Programming Skills Test! Trivia Quiz

15 Questions | Total Attempts: 71

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

.


Questions and Answers
  • 1. 
    Can we write a function that takes a variable argument list and passes the list to another function?
    • A. 

      True

    • B. 

      False

  • 2. 
    What will be the output of the program in Turbo C? #include int main() { char str[10] = "Choice"; str[6] = "User"; printf("%s\n", str); return 0; }
    • A. 

      Choice User

    • B. 

      Choice

    • C. 

      User

    • D. 

      Error

  • 3. 
    What will be the output of the program ? #include int main() { int i; char a[] = "\0"; if(printf("%s", a)) printf("The string is empty\n"); else printf("The string is not empty\n"); return 0; }
    • A. 

      The string is empty

    • B. 

      The string is not empty

    • C. 

      No output

    • D. 

      0

  • 4. 
    If the size of pointer is 32 bits What will be the output of the program ? #include int main() { char a[] = "Visual C++"; char *b = "Visual C++"; printf("%d, %d\n", sizeof(a), sizeof(b)); printf("%d, %d", sizeof(*a), sizeof(*b)); return 0; }
    • A. 

      10, 2 2, 2

    • B. 

      10, 4 1, 2

    • C. 

      11, 4 1, 1

    • D. 

      12, 2 2, 2

  • 5. 
    What will be the output of the program? #include #include int main() { char dest[] = {97, 97, 0}; char src[] = "aaa"; int i; if((i = memcmp(dest, src, 2))==0) printf("Got it"); else printf("Missed"); return 0; }
    • A. 

      Missed

    • B. 

      Got it

    • C. 

      Error in memcmp statement

    • D. 

      None of the above

  • 6. 
    What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample Jan Feb Mar /* sample.c */ #include #include int main(int arc, char *arv[]) { int i; for(i=1; i<_argc; i++) printf("%s ", _argv[i]); return 0;
    • A. 

      No output

    • B. 

      Sample Jan Feb Mar

    • C. 

      Jan Feb Mar

    • D. 

      Error

  • 7. 
    What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample one two three /* sample.c */ #include int main(int argc, char *argv[]) { int i=0; i+=strlen(argv[1]); while(i>0) { printf("%c", argv[1][--i]); } return 0; }
    • A. 

      Three two one

    • B. 

      Owt

    • C. 

      Eno

    • D. 

      Eerht

  • 8. 
    What will be the output of the program #include void fun(int); int main(int argc) { printf("%d\n", argc); fun(argc); return 0; } void fun(int i) { if(i!=4) main(++i); }
    • A. 

      123

    • B. 

      1234

    • C. 

      234

    • D. 

      1

  • 9. 
    What is the output of the program #include int main() { int x = 10, y = 20, z = 5, i; i = x < y < z; printf("%d\n", i); return 0; }
    • A. 

      0

    • B. 

      1

    • C. 

      Error

    • D. 

      None

  • 10. 
    What is the output of the program given below ? #include int main() { enum status { pass, fail, atkt}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = atkt; stud3 = fail; printf("%d, %d, %d\n", stud1, stud2, stud3); return 0; }
    • A. 

      0, 1, 2

    • B. 

      0,2,1

    • C. 

      1, 2, 3

    • D. 

      1,3,2

  • 11. 
    Which files will get closed through the fclose() in the following program? #include int main() { FILE *fs, *ft, *fp; fp = fopen("A.C", "r"); fs = fopen("B.C", "r"); ft = fopen("C.C", "r"); fclose(fp, fs, ft); return 0; }
    • A. 

      "A.C" "B.C" "C.C"

    • B. 

      "B.C" "C.C"

    • C. 

      "A.C"

    • D. 

      Error in fclose()

  • 12. 
          Assunming, integer is 2 byte, What will be the output of the program? #include int main() { printf("%x\n", -2<<2); return 0; }
    • A. 

      Ffff

    • B. 

      0

    • C. 

      Fff8

    • D. 

      Error

  • 13. 
    What will be the output of the program? #include int main() { int fun(int); int i = fun(10); printf("%d\n", --i); return 0; } int fun(int i) { return (i++); }
    • A. 

      9

    • B. 

      10

    • C. 

      11

    • D. 

      8

  • 14. 
    What will be the output of the program in 16 bit platform (Turbo C under DOS) ? #include int main() { struct value { int bit1:1; int bit3:4; int bit4:4; }bit; printf("%d\n", sizeof(bit)); return 0; }
    • A. 

      1

    • B. 

      2

    • C. 

      4

    • D. 

      9

  • 15. 
    What will be the output of the program? #include int addmult(int ii, int jj) { int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } int main() { int i=3, j=4, k, l; k = addmult(i, j); l = addmult(i, j); printf("%d %d\n", k, l); return 0; }
    • A. 

      12,12

    • B. 

      No error,no output

    • C. 

      Error: Compile error

    • D. 

      None