Home » C++ Programming » Interfaces » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    namespace first
    {
    int num = 5;
    }
    namespace second
    {
    int num = 11;
    }
    int main ()
    {
    int num = 27;
    first::num;
    second::num;
    cout << num;
    return 0;
    }
    1. 27
    2. 11
    3. 25
    4. Compilation Error
    5. None of these
Correct Option: A

In this program, as there is lot of variable a and it is printing the value inside the block because it got the highest priority.



Your comments will be displayed only after manual approval.