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

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

        void main()
        {
            int a = 5, b = -7, c = 0, d;
            d = ++a && ++b || ++c;
            printf("\n%d%d%d%d", a,  b, c, d);
        }
  2. A.
    6  -6  0  0
    B.
    6  -5  0  1
    C.
    -6  -6  0  1
    D.
    6  -6  0  1

  3. What is the output of this C code?

        void main()
        {
            int a = -5;
            int k = (a++, ++a);
            printf("%d\n", k);
        }
  4. A.
    -4
    B.
    -5
    C.
    4
    D.
    -3

  5. What is the output of this C code?

        int main()
        {
            int x = 1, y = 0, z = 3;
            x > y ? printf("%d", z) : return z;
        }
  6. A.
    3
    B.
    1
    C.
    Compile time error
    D.
    Run time error

  7. What is the output of this C code?

        void main()
        {
            int x = 1, z = 3;
            int y = x << 3;
            printf(" %d\n", y);
        }
  8. A.
    -2147483648
    B.
    -1
    C.
    Run time error
    D.
    8

  9. What is the output of this C code?

        int main()
        {
            int i = 1;
            if (i++ && (i == 1))
                printf("Yes\n");
            else
                printf("No\n");
        }
  10. A.
    Yes
    B.
    No
    C.
    Depends on the compiler
    D.
    Depends on the standard

  11. Are logical operators sequence points?
  12. A.
    True
    B.
    False
    C.
    Depends on the compiler
    D.
    Depends on the standard

  13. Does logical operators in C language are evaluated with short circuit?
  14. A.
    True
    B.
    False
    C.
    Depends on the compiler
    D.
    depends on the standard

  15. Result of a logical or relational expression in C is?
  16. A.
    True or False
    B.
    0 or 1
    C.
    0 if expression is false and any positive number if expression is true
    D.
    None of the mentioned

  17. What will be the value of d in the following program?

        int main()
        {
            int a = 10, b = 5, c = 5;
            int d;
            d = b + c == a;
            printf("%d", d);
        }
  18. A.
    Syntax error
    B.
    1
    C.
    5
    D.
    10

  19. What is the output of this C code?

        int main()
        {
            int a = 10, b = 5, c = 3;
            b != !a;
            c = !!a;
            printf("%d\t%d", b, c);
        }
  20. A.
    5  1
    B.
    0  3
    C.
    5  3
    D.
    1  1