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

General Knowledge :: Testing New

  1. Determine Output:

    void main()

    {

    printf("%p", main);

    }

  2. A.

     Error

    B.

     make an infinite loop

    C.

     Some address will be printed

    D.

     None of These


  3. Determine Output:

    void main()

    {

    char far *farther, *farthest;

    printf("%d..%d", sizeof(farther), sizeof(farthest));

    }

  4. A.

     4..2

    B.

     2..2

    C.

     4..4

    D.

     2..4


  5. Determine Output:

    void main()

    {

    char *p;

    p="Hello";

    printf("%c", *&*p);

    }

  6. A.

     Hello

    B.

     H

    C.

     Some Address will be printed

    D.

     None of These


  7. Determine Output:

    void main()

    {

    int i=1;

    while(i<=5)

    {

    printf("%d", i);

    if(i>2)

    goto here;

    i++;

    }

    }

    fun()

    {

    here: printf("PP");

    }

  8. A.

     12PP

    B.

     12PP345

    C.

     Compiler Error

    D.

     None of These


  9. Determine Output:

    void main()

    {

    int i=1, j=2;

    switch(i)

    {

    case 1: printf("GOOD"); break;

    case j: printf("BAD"); break;

    }

    }

  10. A.

     GOOD BAD

    B.

     GOOD

    C.

     Compiler Error

    D.

     None of These


  11. Determine Output:

    void main()

    {

    int i;

    printf("%d", scanf("%d", &i)); // value 10 is given as input here

    }

  12. A.

     10

    B.

     1

    C.

     Garbage Value

    D.

     None of These


  13. Determine Output:

    void main()

    {

    int i=0;

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

    printf("%d", i);

    }

  14. A.

     1

    B.

     11

    C.

     12

    D.

     Error


  15. Determine Output:

    void main()

    {

    struct xx

    {

    int x=3;

    char name[] = "hello";

    };

    struct xx *s = malloc(sizeof(struct xx));

    printf("%d", s->x);

    printf("%s", s->name);

    }

  16. A.

     3 hello

    B.

     Compiler Error

    C.

     Linking error

    D.

     None of these


  17. Determine output:

    void main()

    {

    extern int i;

    i=20;

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

    }

  18. A.

     20

    B.

     2

    C.

     Compiler Error

    D.

     Linker Error


  19. Determine Output:

    void main()

    {

    int i=0, j=0;

    if(i && j++)

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

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

    }

  20. A.

     0..1

    B.

     1..0

    C.

     0..0

    D.

     1..1