Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x = -1;
6.
unsigned int y = 2;
7.
8.
if(x > y) {
9.
cout
What is the output of the following program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x = -1;
6.
unsigned int y = 2;
7.
8.
if(x > y) {
9.
cout
Answer: Option A
Was this answer helpful ?
x is promoted to unsigned int on comparison. On conversion x has all bits set, making it the bigger one.
Was this answer helpful ?
Submit Solution