Sail E0 Webinar
Question


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
Options:
A .  11
B .  01
C .  00
D .  10
Answer: Option D

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 ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers