C# - Namespaces Question and Answer
C# - Namespaces Question and Answer
1. If a namespace is present in a library then which of the following is the correct way to use the elements of the namespace?
- dd Reference of the namespace. Use the elements of the namespace.
- Add Reference of the namespace. Import the namespace.
- Use the elements of the namespace.
- 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
2. Which of the following is NOT a namespace in the .NET Framework Class Library?
- System.Process
- System.Security
- System.Threading
- System.Drawing
3. Which of the following statements is correct about a namespace in C#.NET?
- Namespaces help us to control the visibility of the elements present in it.
- A namespace can contain a class but not another namespace.
- If not mentioned, then the name 'root' gets assigned to the namespace.
- It is necessary to use the using statement to be able to use an element of a namespace.
4. Which of the following is absolutely neccessary to use a class Point present in namespace Graph stored in library?
- Use fully qualified name of the Point class.
- Use using statement before using the Point class.
- Add Reference of the library before using the Point class.
- Use using statement before using the Point class.
5. Which of the followings are NOT a .NET namespace?
System.Web
System.Process
System.Data
System.Drawing2D
System.Drawing3D
System.Web
System.Process
System.Data
System.Drawing2D
System.Drawing3D
- 1, 3
- 2, 4, 5
- 3, 5
- 1, 2, 3
6. Which of the following statements is correct about namespaces in C#.NET?
- Namespaces can be nested only up to level 5.
- A namespace cannot be nested.
- There is no limit on the number of levels while nesting namespaces.
- If namespaces are nested, then it is necessary to use using statement while using the elements of the inner namespace.
7. Which of the following statements is correct about the using statement used in C#.NET?
- using statement can be placed anywhere in the C#.NET source code file.
- It is permitted to define a member at namespace level as a using alias.
- A C#.NET source code file can contain any number of using statement.
- By using using statement it is possible to create an alias for the namespace but not for the namespace element
8. Which of the following statements are correct about a namespace used in C#.NET?
Classes must belong to a namespace, whereas structures need not.
Every class, struct, enum, delegate and interlace has to belong to some or the other namespace.
All elements of the namespace have to belong to one file.
If not mentioned, a namespace takes the name of the current project.
The namespace should be imported to be able to use the elements in it.
Classes must belong to a namespace, whereas structures need not.
Every class, struct, enum, delegate and interlace has to belong to some or the other namespace.
All elements of the namespace have to belong to one file.
If not mentioned, a namespace takes the name of the current project.
The namespace should be imported to be able to use the elements in it.
- 1, 3
- 2, 4, 5
- 3, 5
- 4 only
10. Which of the following statements is correct about a namespace used in C#.NET?
- Nested namespaces are not allowed.
- Importing outer namespace imports inner namespace.
- Nested namespaces are allowed.
- If nested, the namespaces cannot be split across files.