Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5, b = 6, c;
6.
c = (a > b) ? a : b;
7.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5, b = 6, c;
6.
c = (a > b) ? a : b;
7.
cout
Answer: Option A
Was this answer helpful ?
Here the condition is false on conditional operator, so the b value is assigned to c.
Output:
$ g++ op1.cpp
$ a.out
6
Was this answer helpful ?
More Questions on This Topic :
Question 4.
What is the use of dynamic_cast operator?
....
Question 7.
What is this operator called ?: ?
....
Submit Solution