Home / CSE MCQs / C++ - MCQs :: Operators and Statements - C++

CSE MCQs :: C++ - MCQs

  1. Which operator is having right to left associativity in the following?
  2. A.
    Array subscripting
    B.
    Function call
    C.
    Addition and subtraction
    D.
    Type cast

  3. Which operator is having the highest precedence?
  4. A.
    postfix
    B.
    unary
    C.
    shift
    D.
    equality

  5. What is this operator called ?: ?
  6. A.
    conditional
    B.
    relational
    C.
    casting operator
    D.
    none of the mentioned

  7. What is the output of this program?

    #include

    using namespace std;

    int main()

    {

    int a;

    a = 5 + 3 * 5;

    cout << a;

    return 0;

    }

  8. A.
    35
    B.
    20
    C.
    25
    D.
    30

  9. What is the use of dynamic_cast operator?
  10. A.
    it converts virtual base class to derived class
    B.
    it converts virtual base object to derived objeccts
    C.
    it will convert the operator based on precedence
    D.
    None of the mentioned

  11. What is the output of this program?

    #include < iostream >

    using namespace std;

    int main()

    {

    int a = 5, b = 6, c, d;

    c = a, b;

    d = (a, b);

    cout << c << 't' << d;

    return 0;

    }


  12. A.
    5 6
    B.
    6 5
    C.
    6 7
    D.
    none of the mentioned

  13. What is the output of this program?

    #include < iostream >

    using namespace std;

    int main()

    {

    int i, j;

    j = 10;

    i = (j++, j + 100, 999 + j);

    cout << i;

    return 0;

    }

  14. A.
    1000
    B.
    11
    C.
    1010
    D.
    1001

  15. What is the output of this program?
    #include < iostream >
    using namespace std;
    int main ()
    {
    int x, y;
    x = 5;
    y = ++x * ++x;
    cout << x << y;
    x = 5;
    y = x++ * ++x;
    cout << x << y;
    return 0;
    }
  16. A.
    749736
    B.
    736749
    C.
    367497
    D.
    none of the mentioned

  17. What is the output of this program?

    #include < iostream >

    using namespace std;

    int main()

    {

    int a = 5, b = 6, c;

    c = (a > b) ? a : b;

    cout << c;

    return 0;

    }

  18. A.
    6
    B.
    5
    C.
    4
    D.
    7

  19. What is the output of this program?

    #include < iostream >

    using namespace std;

    main()

    {

    double a = 21.09399;

    float b = 10.20;

    int c ,d;

    8.        c = (int) a;

    d = (int) b;

    cout << c <<'t'<< d;

    return 0;

    }

  20. A.
    20 10
    B.
    10 21
    C.
    21 10
    D.
    none of the mentioned