Interfaces
- Identify the correct statement.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Namespace allows you to group class, objects, and functions. It is used to divide the global scope into the sub-scopes.
- What is the use of Namespace?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The main aim of the namespace is to understand the logical units of the program and to make the program so robust.
- What is the general syntax for accessing the namespace variable?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
namespace::operator
- What is the output of this program?
#include
using namespace std;
namespace One
{
int num = 12;
}
namespace Two
{
double num = 10.027;
}
int main ()
{
int n;
n = One::num + Two::num;
cout << n;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
As we are getting two variables from namespace variable and we are adding that.
- What is the output of this program?
#include
using namespace std;
namespace One
{
int K = 15;
int L = 11;
}
namespace Two
{
double K = 4.016;
double L = 7.6001;
}
int main ()
{
using One::K;
using Two::L;
bool p, q;
p = K > L;
q = One::K < Two::L;
cout << p <<" " << q;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
We are inter mixing the variable and comparing it which is bigger and smaller and according to that we are printing the output.