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

General Knowledge :: Testing New

  1. Determine Output:

    void main()

    {

    int i=10;

    i=!i>14;

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

    }

  2. A.

     10

    B.

     14

    C.

     0

    D.

     1


  3. Determine Output:

    void main()

    {

    int c = - -2;

    printf("c=%d", c);

    }

  4. A.

     1

    B.

     -2

    C.

     2

    D.

     Error


  5. Determine Output:

    #define int char

    void main()

    {

    int i = 65;

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

    }

  6. A.

     sizeof(i)=2

    B.

     sizeof(i)=1

    C.

     Compiler Error

    D.

     None of These


  7. Determine Output:

    void main()

    {

    int i=3;

    switch(i)

    {

    default: printf("zero");

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

    case 2: printf("two"); break;

    case 3: printf("three"); break;

    }

    }

  8. A.

     zero

    B.

     three

    C.

     Error

    D.

     None of These


  9. Determine Output:

    void main()

    {

    char string[]="Hello World";

    display(string);

    }

    void display(char *string)

    {

    printf("%s", string);

    }

  10. A.

     will print Hello World

    B.

     Compiler Error

    C.

     Can't Say

    D.

     None of These


  11. Determine Output:

    void main()

    {

    int i=5;

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

    }

  12. A.

     45545

    B.

     54544

    C.

     55445

    D.

     54554


  13. Determine Output:

    #define square(x) x*x

    void main()

    {

    int i;

    i = 64/square(4);

    printf("%d", i);

    }

  14. A.

     4

    B.

     64

    C.

     16

    D.

     None of These


  15. Determine Output:

    void main()

    {

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

    p1=p;

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

    printf("%s", p1);

    }

  16. A.

     hi friends

    B.

     ij!gsjfoet

    C.

     hj grjeodt

    D.

     None of These


  17. Determine Output:

    #include<stdio.h>

    #define a 10

    void main()

    {

    #define a 50

    printf("%d", a);

    }

  18. A.

     50

    B.

     10

    C.

     Compiler Error

    D.

     None of These


  19. Determine Output:

    #define clrscr() 100

    void main()

    {

    clrscr();

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

    }

  20. A.

     0

    B.

     1

    C.

     100

    D.

     Error