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

General Knowledge :: Testing New

  1. Determine Output:

    void main()

    {

    char not;

    not = !2;

    printf("%d", not);

    }

  2. A.

     2

    B.

     Garbage Value

    C.

     0

    D.

     None of These


  3. Determine Output:

    #include<stdio.h>

    void main()

    {

    register i=5;

    char j[]= "hello";

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

    }

  4. A.

     hello 5

    B.

     hello garbage value

    C.

     Error

    D.

     None of These


  5. Determine Output:

    void main()

    {

    int i=5, j=6, z;

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

    }

  6. A.

     12

    B.

     13

    C.

     11

    D.

     None of These


  7. Determine Output:

    void main()

    {

    int i = abc(10);

    printf("%d", --i);

    }

    int abc(int i)

    {

    return(i++);

    }

  8. A.

     10

    B.

     9

    C.

     11

    D.

     None of These


  9. Determine Output:

    void main()

    {

    char a[]="12345";

    int i = strlen(a);

    printf("%d", ++i);

    }

  10. A.

     5

    B.

     6

    C.

     7

    D.

     None of These


  11. Determine Output:

    void main()

    {

    int i;

    char a[]="�";

    if(printf("%sn", a))

    printf("Ok here n");

    else

    printf("Forget itn");

    }

  12. A.

     Ok here

    B.

     Forget it

    C.

     Error

    D.

     None of These


  13. Determine Output:

    void main()

    {

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

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

    }

  14. A.

     1 1 1

    B.

     0 0 0

    C.

     garbage values

    D.

     Error


  15. Determine Output:

    void main()

    {

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

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

    }

  16. A.

     1 1 1

    B.

     0 0 0

    C.

     garbage values

    D.

     Error


  17. Determine Output:

    #define prod(a,b) a*b

    void main()

    {

    int x=3, y=4;

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

    }

  18. A.

     15

    B.

     10

    C.

     12

    D.

     11


  19. Determine Output:

    void main()

    {

    char p[]="%dn";

    p[1] = 'c';

    printf(p, 65);

    }

  20. A.

     65

    B.

     c

    C.

     A

    D.

     Error