Operators


  1. What is the output of this program?












  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    In this program, the increment and decrement of evaluation of Res will not be accounted because they are post.


  1. What is the output of this program?
    #include <iostream> 
    using namespace std;
    int main()
    {
    int num1 = 10, num2 = 12;
    cout << ++num1 <<" "<< --num2 << endl;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    The values will be pre increment and pre decrement, So it will print as 11 11.



  1. What is the output of this program?
    #include <iostream> 
    using namespace std;
    int main()
    {
    int num = 15;
    int Res ;
    Res = num++;
    cout << Res;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    value of ‘num’ will be stored in Res and then only it will be incremented.


  1. Pick out the correct statement.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Increment operator ++ adds 1 to its operand



  1. How many types are there in increment/decrement operator?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    There are two types of increment/decrement. They are postfix and prefix.