Exercise: Namespaces

Questions for: Namespaces

Which of the following is absolutely neccessary to use a class Point present in namespace Graph stored in library?
A:
Use fully qualified name of the Point class.
B:
Use using statement before using the Point class.
C:
Add Reference of the library before using the Point class.
D:
Use using statement before using the Point class.
Answer: C
No answer description is available. Let's discuss.
Which of the following statements is correct about a namespace in C#.NET?
A:
Namespaces help us to control the visibility of the elements present in it.
B:
A namespace can contain a class but not another namespace.
C:
If not mentioned, then the name 'root' gets assigned to the namespace.
D:
It is necessary to use the using statement to be able to use an element of a namespace.
Answer: A
No answer description is available. Let's discuss.
Which of the following statments are the correct way to call the method Issue() defined in the code snippet given below?
namespace College
{
    namespace Lib
    {
        class Book
        {
            public void Issue()
            {
                // Implementation code
            }
        }
        class Journal
        {
            public void Issue()
            {
                // Implementation code
            }
        }
    }
}
  1. College.Lib.Book b = new College.Lib.Book(); 
    b.Issue();
  2. Book b = new Book(); 
    b.Issue();
  3. using College.Lib; 
    Book b = new Book(); 
    b.Issue();
  4. using College;
    Lib.Book b = new Lib.Book(); 
    b.Issue();
  5. using College.Lib.Book; 
    Book b = new Book(); 
    b.Issue();
A:
1, 3
B:
2, 4
C:
3
D:
4, 5
Answer: A
No answer description is available. Let's discuss.
Which of the following is NOT a namespace in the .NET Framework Class Library?
A:
System.Process
B:
System.Security
C:
System.Threading
D:
System.Drawing
Answer: A
No answer description is available. Let's discuss.
If a namespace is present in a library then which of the following is the correct way to use the elements of the namespace?
A:
Add Reference of the namespace.
Use the elements of the namespace.
B:
Add Reference of the namespace.
Import the namespace.
Use the elements of the namespace.
C:
Import the namespace.
Use the elements of the namespace.
D:
Copy the library in the same directory as the project that is trying to use it.
Use the elements of the namespace.
Answer: B
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz