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

General Knowledge :: Testing New

  1. Determine Output:

    void main()

    {

    char string[]="Hello World";

    display(string);

    }

    void display(char *string)

    {

    printf("%s", string);

    }

  2. A.

     will print Hello World

    B.

     Compiler Error

    C.

     Can't Say

    D.

     None of These


  3. Determine Output:

    void main()

    {

    int i=5;

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

    }

  4. A.

     45545

    B.

     54544

    C.

     55445

    D.

     54554


  5. Determine Output:

    #define square(x) x*x

    void main()

    {

    int i;

    i = 64/square(4);

    printf("%d", i);

    }

  6. A.

     4

    B.

     64

    C.

     16

    D.

     None of These


  7. Determine Output:

    void main()

    {

    char *p="hi friends", *p1;

    p1=p;

    while(*p!='\0') ++*p++;

    printf("%s", p1);

    }

  8. A.

     hi friends

    B.

     ij!gsjfoet

    C.

     hj grjeodt

    D.

     None of These


  9. Determine Output:

    #include<stdio.h>

    #define a 10

    void main()

    {

    #define a 50

    printf("%d", a);

    }

  10. A.

     50

    B.

     10

    C.

     Compiler Error

    D.

     None of These


  11. Determine Output:

    #define clrscr() 100

    void main()

    {

    clrscr();

    printf("%d", clrscr());

    }

  12. A.

     0

    B.

     1

    C.

     100

    D.

     Error


  13. Determine Output:

    void main()

    {

    printf("%p", main);

    }

  14. A.

     Error

    B.

     make an infinite loop

    C.

     Some address will be printed

    D.

     None of These


  15. Determine Output:

    void main()

    {

    char far *farther, *farthest;

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

    }

  16. A.

     4..2

    B.

     2..2

    C.

     4..4

    D.

     2..4


  17. Determine Output:

    void main()

    {

    char *p;

    p="Hello";

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

    }

  18. A.

     Hello

    B.

     H

    C.

     Some Address will be printed

    D.

     None of These


  19. Determine Output:

    void main()

    {

    int i=1;

    while(i<=5)

    {

    printf("%d", i);

    if(i>2)

    goto here;

    i++;

    }

    }

    fun()

    {

    here: printf("PP");

    }

  20. A.

     12PP

    B.

     12PP345

    C.

     Compiler Error

    D.

     None of These