Interfaces


  1. Identify the correct statement.











  1. 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.


  1. What is the use of Namespace?











  1. 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.



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    namespace::operator


  1. 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;
    }











  1. 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.



  1. 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;
    }











  1. 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.