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

General Knowledge :: Testing New

  1. Determine Output:

    void main()

    {

    static int i=5;

    if(--i){

    main();

    printf("%d ", i);

    }

    }

  2. A.

     5 4 3 2 1

    B.

     0 0 0 0

    C.

     Infinite Loop

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Determine Output:

    void main()

    {

    int i=-1, j=-1, k=0, l=2, m;

    m = i++ && j++ && k++ || l++;

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

    }

  4. A.

     0 0 1 2 0

    B.

     0 0 1 3 0

    C.

     0 0 1 3 1

    D.

     0 0 0 2 1

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Determine Output:

    void main()

    {

    int i = -1;

    +i;

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

    }

  6. A.

     i = -1, +i = 1

    B.

     i = 1, +i = 1

    C.

     i = -1, +i = -1

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Determine Output:

    void main()

    {

    char *str1 = "abcd";

    char str2[] = "abcd";

    printf("%d %d %d", sizeof(str1), sizeof(str2), sizeof("abcd"));

    }

  8. A.

     2 5 5

    B.

     5 5 5

    C.

     2 4 5

    D.

     2 4 4

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Determine Output:

    void main()

    {

    char not;

    not = !2;

    printf("%d", not);

    }

  10. A.

     2

    B.

     Garbage Value

    C.

     0

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Determine Output:

    #include<stdio.h>

    void main()

    {

    register i=5;

    char j[]= "hello";

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

    }

  12. A.

     hello 5

    B.

     hello garbage value

    C.

     Error

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Determine Output:

    void main()

    {

    int i=5, j=6, z;

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

    }

  14. A.

     12

    B.

     13

    C.

     11

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Determine Output:

    void main()

    {

    int i = abc(10);

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

    }

    int abc(int i)

    {

    return(i++);

    }

  16. A.

     10

    B.

     9

    C.

     11

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Determine Output:

    void main()

    {

    char a[]="12345";

    int i = strlen(a);

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

    }

  18. A.

     5

    B.

     6

    C.

     7

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Determine Output:

    void main()

    {

    int i;

    char a[]="�";

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

    printf("Ok here n");

    else

    printf("Forget itn");

    }

  20. A.

     Ok here

    B.

     Forget it

    C.

     Error

    D.

     None of These

    View Answer

    Workspace

    Discuss Discuss in Forum