Question
1.
#include
2.
using namespace std
3.
namespace space
4.
{
5.
int x = 10;
6.
}
7.
namespace space
8.
{
9.
int y = 15;
10.
}
11.
int main(int argc, char * argv[])
12.
{
13.
space::x = space::y =5;
14.
cout
What is the output of this program?
1.
#include
2.
using namespace std
3.
namespace space
4.
{
5.
int x = 10;
6.
}
7.
namespace space
8.
{
9.
int y = 15;
10.
}
11.
int main(int argc, char * argv[])
12.
{
13.
space::x = space::y =5;
14.
cout
Answer: Option C
Was this answer helpful ?
We are overriding the value at the main function and so we are getting the output as 55.
Output:
$ g++ name4.cpp
$ a.out
55
Was this answer helpful ?
Submit Solution