Namespaces

Q1: If a class called Point is present in namespace n1 as well as in namespace n2, then which of the following is the correct way to use the Point class?

A
namespace AptitudeCrackConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        { 
            import n1; 
            Point x = new Point();
            x.fun();
            import n2;
            Point y = new Point(); 
            y.fun();
        }
    }
}

B
import n1; 
import n2;
namespace AptitudeCrackConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        {
            n1.Point x = new n1.Point(); 
            x.fun();
            n2.Point y = new n2.Point(); 
            y.fun();
        }
    }
}

C
namespace AptitudeCrackConsoleApplication
{ 
    class MyProgram
    {
        static void Main(string[] args)
        {
            using n1;
            Point x = new Point();
            x.fun();
            using n2;
            Point y = new Point();
            y.fun();
        }
    }
}

D
using n1;
using n2; 
namespace AptitudeCrackConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        { 
            n1.Point x = new n1.Point(); 
            x.fun();
            n2.Point y = new n2.Point(); 
            y.fun(); 
        } 
    } 
}

ANS:D -

using n1;
using n2; 
namespace AptitudeCrackConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        { 
            n1.Point x = new n1.Point(); 
            x.fun();
            n2.Point y = new n2.Point(); 
            y.fun(); 
        } 
    } 
}

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.