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

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

        int main()
        {
            int a = 20;
            double b = 15.6;
            int c;
            c = a + b;
            printf("%d", c);
        }
  2. A.
    35
    B.
    36
    C.
    35.6
    D.
    30

  3. What is the output of this C code?

        int main()
        {
            int a = 20, b = 15, c = 5;
            int d;
            d = a == (b + c);
            printf("%d", d);
        }
  4. A.
    1
    B.
    40
    C.
    10
    D.
    5

  5. What is the output of this C code?

        void main()
        {
            int x = 0;
            if (x = 0)
                printf("Its zero\n");
            else
                printf("Its not zero\n");
        }

  6. A.
    Its not zero
    B.
    Its zero
    C.
    Run time error
    D.
    None

  7. What is the output of this C code?

        void main()
        {
            int k = 8;
            int x = 0 == 1 && k++;
            printf("%d%d\n", x, k);
        }
  8. A.
    0   9
    B.
    0   8
    C.
    1   9
    D.
    1   8

  9. What is the output of this C code?

        void main()
        {
            char a = 'a';
            int x = (a % 10)++;
            printf("%d\n", x);
        }
  10. A.
    6
    B.
    Junk value
    C.
    Compile time error
    D.
    7

  11. What is the output of this C code?

        void main()

        {
            1 < 2 ? return 1: return 2;
        }

  12. A.
    returns 1
    B.
    returns 2
    C.
    varies
    D.
    Compile time error

  13. What is the output of this C code?


        void main()
        {
            unsigned int x = -5;
            printf("%d", x);
        }

  14. A.
    Run time error
    B.
    Varies
    C.
    -5
    D.
    5

  15. What is the output of this C code?

        int main()
        {
            int x = 2, y = 1;
            x *= x + y;
            printf("%d\n", x);
            return 0;
        }
  16. A.
    5
    B.
    6
    C.
    Undefined behaviour
    D.
    Compile time error

  17. What is the output of this C code?

        int main()
        {
            int x = 2, y = 2;
            x /= x / y;
            printf("%d\n", x);
            return 0;
        }
  18. A.
    2
    B.
    1
    C.
    0.5
    D.
    Undefined behaviour

  19. What is the type of the below assignment expression if x is of type float, y is of type int?
            y = x + y;
  20. A.
    int
    B.
    float
    C.
    There is no type for an assignment expression
    D.
    double