Home / CSE MCQs / C-MCQs :: C Operators

CSE MCQs :: C-MCQs

  1. Operation "a = a * b + a can also be written as:
  2. A.
    a *= b + 1;
    B.
    (c = a * b)!=(a = c + a);
    C.
    a = (b + 1)* a;
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. for c = 2, value of c after c <<= 1;
  4. A.
    c = 1;
    B.
    c = 2;
    C.
    c = 3;
    D.
    c = 4;

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of this C code?

        int main()
        {
            int a = 1, b = 2;
            a += b -= a;
            printf("%d %d", a, b);
        }
  6. A.
    1   1
    B.
    1   2
    C.
    2   1
    D.
    2   2

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the output of this C code?

        int main()
        {
            int a = 4, n, i, result = 0;
            scanf("%d", n);
            for (i = 0;i < n; i++)
            result += a;
        }

  8. A.
    Addition of a and n.
    B.
    Subtraction of a and n.
    C.
    Multiplication of a and n.
    D.
    Division of a and n.

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Which of the following is an invalid assignment operator?
  10. A.
    a %= 10;
    B.
    a /= 10;
    C.
    a |= 10;
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What is the output of this C code?

        int main()
        {
            unsigned int a = 10;
            a = ~a;
            printf("%d\n", a);
        }
  12. A.
    -9
    B.
    -10
    C.
    -11
    D.
    10

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What is the output of this C code?

        int main()
        {
            if (7 & 8)
            printf("Honesty");
                if ((~7 & 0x000f) == 8)
                    printf("is the best policy\n");
        }

  14. A.
    Honesty is the best policy
    B.
    Honesty
    C.
    is the best policy
    D.
    No output

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Comment on the output of this C code?

        int main()
        {
            int i, n, a = 4;
            scanf("%d", &n);
            for (i = 0; i < n; i++)
                a = a * 2;
        }
  16. A.
    Logical Shift left
    B.
    No output
    C.
    Arithmetic Shift right
    D.
    bitwise exclusive OR

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What is the output of this C code?

        void main()
        {
            int x = 97;
            int y = sizeof(x++);
            printf("x is %d", x);
        }
  18. A.
    x is 97
    B.
    x is 98
    C.
    x is 99
    D.
    Run time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What is the output of this C code?

        void main()
        {
            int x = 4, y, z;
            y = --x;
            z = x--;
            printf("%d%d%d", x, y, z);
        }

  20. A.
    3  2  3
    B.
    2  2  3
    C.
    3  2  2
    D.
    2  3  3

    View Answer

    Workspace

    Discuss Discuss in Forum