Home » C++ Programming » Interfaces » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    namespace calc
    {
    int p = 12;
    }
    namespace calc
    {
    int q = 23;
    }
    int main(int argc, char * argv[])
    {
    calc::p = calc::q =6;
    cout << calc::p << calc::q;
    }
    1. 66
    2. 12
    3. 23
    4. 6
    5. None of these
Correct Option: A

We are overriding the value at the main function and so we are getting the output as 66.



Your comments will be displayed only after manual approval.