Home / General Knowledge / Testing New :: C Fundamentals MCQs

General Knowledge :: Testing New

  1. Determine Output:

    void main()

    {

    int i=i++, j=j++, k=k++;

    printf("%d %d %d", i, j, k);

    }

  2. A.

     1 1 1

    B.

     0 0 0

    C.

     garbage values

    D.

     Error


  3. Determine Output:

    void main()

    {

    static int i=i++, j=j++, k=k++;

    printf("%d %d %d", i, j, k);

    }

  4. A.

     1 1 1

    B.

     0 0 0

    C.

     garbage values

    D.

     Error


  5. Determine Output:

    #define prod(a,b) a*b

    void main()

    {

    int x=3, y=4;

    printf("%d", prod(x+2, y-1));

    }

  6. A.

     15

    B.

     10

    C.

     12

    D.

     11


  7. Determine Output:

    void main()

    {

    char p[]="%dn";

    p[1] = 'c';

    printf(p, 65);

    }

  8. A.

     65

    B.

     c

    C.

     A

    D.

     Error


  9. Determine Output:

    void main()

    {

    char *p;

    p="%dn";

    p++;

    p++;

    printf(p-2, 300);

    }

  10. A.

     %d\n

    B.

     300

    C.

     Error

    D.

     None of These


  11. Determine Output:

    void main()

    {

    int c[] = {2.8,3.4,4,6.7,5};

    int j, *p=c, *q=c;

    for(j=0;j<5;j++){

    printf(" %d ", *c);

    ++q;

    }

    for(j=0;j<5;j++){

    printf(" %d ", *p);

    ++p;

    }

    }

  12. A.

     2 3 4 6 5 2 3 4 6 5

    B.

     2.8 3.4 4 6.7 5 2.8 3.4 4 6.7

    C.

     2.8 2.8 2.8 2.8 2.8 2.8 3.4 4

    D.

     2 2 2 2 2 2 3 4 6 5


  13. Determine Output:

    void main()

    {

    int a[] = {10,20,30,40,50}, j, *p;

    for(j=0; j<5; j++){

    printf("%d" ,*a);

    a++;

    }

    p = a;

    for(j=0; j<5; j++){

    printf("%d" ,*p);

    p++;

    }

    }

  14. A.

     10 20 30 40 50 10 20 30 40 50

    B.

     10 20 30 40 50 Garbage Value

    C.

     Error

    D.

     None of These


  15. Determine Output:

    #include<stdio.h>

    void main()

    {

    char s[]={'a','b','c','n','c','\0'};

    char *p, *str, *str1;

    p=&s[3];

    str=p;

    str1=s;

    printf("%c", ++*p + ++*str1-32);

    }

  16. A.

     N

    B.

     P

    C.

     M

    D.

     None of These


  17. Determine Output:

    void main()

    {

    static char *s[] = {"black", "white", "yellow", "violet"};

    char **ptr[] = {s+3, s+2, s+1, s}, ***p;

    p = ptr;

    ++p;

    printf("%s",*--*++p + 3);

    }

  18. A.

     te

    B.

     ow

    C.

     et

    D.

     ck