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

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

        int main()
        {
            int i = -5;
            int k = i %4;
            printf("%d\n", k);
        }
  2. A.
    Compile time error
    B.
    -1
    C.
    1
    D.
    None

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the output of this C code?

        int main()
        {
            int i = 5;
            int l = i / -4;
            int k = i % -4;
            printf("%d %d\n", l, k);
            return 0;
        }

  4. A.
    Compile time error
    B.
    -1  1
    C.
    1  -1
    D.
    Run time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of this C code?

        int main()
        {
            int i = 7;
            i = i / 4;
            printf("%d\n", i);
           return 0;
        }
  6. A.
    Run time error
    B.
    1
    C.
    3
    D.
    Compile time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the value of x in this C code?

        void main()
        {
            int x = 4 *5 / 2 + 9;
        }
  8. A.
    6.75
    B.
    1.85
    C.
    19
    D.
    3

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the output of this C code?

        void main()
        {
            int x = 4.3 % 2;
            printf("Value of x is %d", x);
        }
  10. A.
    Value of x is 1.3
    B.
    Value of x is 2
    C.
    Value of x is 0.3
    D.
    Compile time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What is the output of this C code?

        void main()
        {
            int y = 3;
            int x = 7 % 4 * 3 / 2;
            printf("Value of x is %d", x);
        }

  12. A.
    Value of x is 1
    B.
    Value of x is 2
    C.
    Value of x is 3
    D.
    Compile time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What is the output of this C code?

        void main()
        {
            int a = 5;
            int b = ++a + a++ + --a;
            printf("Value of b is %d", b);
        }

  14. A.
    Value of x is 16
    B.
    Value of x is 21
    C.
    Value of x is 15
    D.
    Undefined behaviour

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. The precedence of arithmetic operators is (from highest to lowest)?
  16. A.
    %, *, /, +, -
    B.
    %, +, /, *, -
    C.
    +, -, %, *, /
    D.
    %, +, -, *, /

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Which of the following is not an arithmetic operation?
  18. A.
    a *= 20;
    B.
    a /= 30;
    C.
    a %= 40;
    D.
    a != 50;

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Which of the following data type will throw an error on modulus operation(%)?
  20. A.
    char
    B.
    short
    C.
    float
    D.
    int

    View Answer

    Workspace

    Discuss Discuss in Forum