Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C++ Programming :: Namespaces

Home > C++ Programming > Namespaces > General Questions

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Namespace allow you to group class, objects and functions. It is used to divide the global scope into the sub-scopes.

Workspace

Tags:

No Tags on this question yet!

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

The main aim of the namespace is to understand the logical units of the program and to make the program so robust.

Workspace

Tags:

No Tags on this question yet!

4. What is the general syntax for accessing the namespace variable?

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

5. Which keyword is used to access the variable in namespace?

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

6. What is the output of the below C++ program?

#include
using namespace std;
namespace Box1
{
int a = 4;
}
namespace Box2
{
int a = 13;
}

int main ()
{
int a = 16;
Box1::a;
Box2::a;
cout << a;
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

There is lot of variable a and it is printing the value inside the block because it got the highest priority.

Workspace

Tags:

No Tags on this question yet!

7. What is the output of the below C++ program?

#include
using namespace std;
namespace first
{
int var = 5;
}
namespace second
{
double var = 3.1416;
}
int main ()
{
int a;
a = first::var + second::var;
cout << a;
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Two variables from namespace variable and we are adding that.

Workspace

Tags:

No Tags on this question yet!

8. What is the output of the below C++ Program?

#include
using namespace std;
namespace first
{
int x = 5;
int y = 10;
}
namespace second
{
double x = 3.1416;
double y = 2.7183;
}
int main ()
{
using first::x;
using second::y;
bool a, b;
a = x > y;
b = first::y < second::x;
cout << a << b;
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

We are inter mixing the variable and comparing it which is bigger and smaller and according to that we are printing the output.

Workspace

Tags:

No Tags on this question yet!

9. What is the output of the below C++ program?

#include
using namespace std
namespace space
{
int x = 10;
}
namespace space
{
int y = 15;
}
int main(int argc, char * argv[])
{
space::x = space::y =5;
cout << space::x << space::y;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

10. What is the output of the below C++ program?

#include
using namespace std;
namespace extra
{
int i;
}
void i()
{
using namespace extra;
int i;
i = 9;
cout << i;
}
int main()
{
enum letter { i, j};
class i { letter j; };
::i();
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

cope resolution operator without a scope qualifier refers to the global namespace.

Workspace

Tags:

No Tags on this question yet!