logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Namespaces See What Others Are Saying!
  • Question
  • 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?


  • Options
  • A.
    namespace CuriousTabConsoleApplication
    { 
        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 CuriousTabConsoleApplication
    { 
        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 CuriousTabConsoleApplication
    { 
        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 CuriousTabConsoleApplication
    { 
        class MyProgram
        { 
            static void Main(string[] args)
            { 
                n1.Point x = new n1.Point(); 
                x.fun();
                n2.Point y = new n2.Point(); 
                y.fun(); 
            } 
        } 
    }

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


  • More questions

    • 1. Which of the following assemblies can be stored in Global Assembly Cache?

    • Options
    • A. Private Assemblies
    • B. Friend Assemblies
    • C. Shared Assemblies
    • D. Public Assemblies
    • E. Protected Assemblies
    • Discuss
    • 2. Which of the following statements are correct?

      1. A struct can contain properties.
      2. A struct can contain constructors.
      3. A struct can contain protected data members.
      4. A struct cannot contain methods.
      5. A struct cannot contain constants.

    • Options
    • A. 1, 2
    • B. 3, 4
    • C. 1, 2, 4
    • D. 3, 5
    • Discuss
    • 3. Which of the following is the correct size of a Decimal datatype?

    • Options
    • A. 8 Bytes
    • B. 4 Bytes
    • C. 10 Bytes
    • D. 16 Bytes
    • E. None of the above.
    • Discuss
    • 4. Which of the following statements are correct about inspecting an attribute in C#.NET?

      1. An attribute can be inspected at link-time.
      2. An attribute can be inspected at compile-time.
      3. An attribute can be inspected at run-time.
      4. An attribute can be inspected at design-time.

    • Options
    • A. 1, 2
    • B. 3, 4
    • C. 1, 3, 4
    • D. All of the above
    • E. None of the above
    • Discuss
    • 5. In C#.NET if we do not catch the exception thrown at runtime then which of the following will catch it?

    • Options
    • A. Compiler
    • B. CLR
    • C. Linker
    • D. Loader
    • E. Operating system
    • Discuss
    • 6. Which of the folowing does an indexer allow to index in the same way as an array?

      1. A class
      2. A property
      3. A struct
      4. A function
      5. An interface

    • Options
    • A. 1, 3, 5
    • B. 2, 4
    • C. 3, 5
    • D. 3, 4, 5
    • Discuss
    • 7. Which of the following is NOT an Assignment operator in C#.NET?

    • Options
    • A. \=
    • B. /=
    • C. *=
    • D. +=
    • E. %=
    • Discuss
    • 8. How many values is a function capable of returning?

    • Options
    • A. 1
    • B. 0
    • C. Depends upon how many params arguments does it use.
    • D. Any number of values.
    • E. Depends upon how many ref arguments does it use.
    • Discuss
    • 9. Creating empty structures is allowed in C#.NET.

    • Options
    • A. True
    • B. False
    • Discuss
    • 10. It is illegal to make objects of one class as members of another class.

    • Options
    • A. True
    • B. False
    • Discuss


    Comments

    There are no comments.

Enter a new Comment