Question
1.
#include
2.
using namespace std;
3.
namespace first
4.
{
5.
int x = 5;
6.
int y = 10;
7.
}
8.
namespace second
9.
{
10.
double x = 3.1416;
11.
double y = 2.7183;
12.
}
13.
int main ()
14.
{
15.
using first::x;
16.
using second::y;
17.
bool a, b;
18.
a = x > y;
19.
b = first::y < second::x;
20.
cout
What is the output of these program?
1.
#include
2.
using namespace std;
3.
namespace first
4.
{
5.
int x = 5;
6.
int y = 10;
7.
}
8.
namespace second
9.
{
10.
double x = 3.1416;
11.
double y = 2.7183;
12.
}
13.
int main ()
14.
{
15.
using first::x;
16.
using second::y;
17.
bool a, b;
18.
a = x > y;
19.
b = first::y < second::x;
20.
cout
Answer: Option D
Was this answer helpful ?
We are inter mixing the variable and comparing it which is bigger and smaller and according
to that we are printing the output.
Output:
$ g++ name1.cpp
$ a.out
10
Was this answer helpful ?
Submit Solution