Operators
- What is the output of this program?
-
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.
- 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;
}
-
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.
- 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;
}
-
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.
- Pick out the correct statement.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Increment operator ++ adds 1 to its operand
- How many types are there in increment/decrement operator?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
There are two types of increment/decrement. They are postfix and prefix.