Namespace



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?  

  • 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.
  • E) Install the namespace in Global Assembly Cache. Use the elements of the namespace.


2. Which of the following is NOT a namespace in the .NET Framework Class Library?  

  • A) System.Xml
  • B) System.Drawing
  • C) System.Threading
  • D) System.Security
  • E) System.Process


3. Which of the following statements is correct about a namespace in C#.NET?  

  • A) A namespace can contain a class but not another namespace.
  • B) If not mentioned, then the name 'root' gets assigned to the namespace.
  • C) Namespaces help us to control the visibility of the elements present in it.
  • D) We need to organise the classes declared in Framework Class Library into different namespaces.
  • E) 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?  

  • 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.
  • E) Copy the library into the current project directory before using the Point class.



5. Which of the followings are NOT a .NET namespace?  

  • A) System.Web
  • B) System.Process
  • C) System.Data
  • D) System.Drawing2D
  • E) System.Drawing3D


6. Which of the following statements is correct about namespaces in C#.NET?  

  • A) Namespaces can be nested only up to level 5.
  • B) A namespace cannot be nested.
  • C) There is no limit on the number of levels while nesting namespaces.
  • D) If namespaces are nested, then it is necessary to use using statement while using the elements of the inner namespace.
  • E) Nesting of namespaces is permitted, provided all the inner namespaces are declared in the same file.


7. Which of the following statements is correct about the using statement used in C#.NET?  

  • A) A C#.NET source code file can contain any number of using statement.
  • B) using statement can be placed anywhere in the C#.NET source code file.
  • C) It is permitted to define a member at namespace level as a using alias.
  • D) By using using statement it is possible to create an alias for the namespace but not for the namespace element.
  • E) By using using statement it is possible to create an alias for the namespace element but not for the namespace.


8. Which of the following CANNOT belong to a C#.NET Namespace?  

  • A) class
  • B) enum
  • C) struct
  • D) Data
  • E) interface


9. Which of the following statements is correct about a namespace used in C#.NET?  

  • A) Importing outer namespace imports inner namespace.
  • B) Nested namespaces are allowed.
  • C) Nested namespaces are not allowed.
  • D) If nested, the namespaces cannot be split across files.
  • E) All of the above


10. What is Difference between NameSpace and Assembly?  

Following are the differences between namespace and assembly: -> Assembly is physical grouping of logical units, Namespace, logically groups classes. -> Namespace can span multiple assembly.


11. Which namespaces are required to enable the use of databases in ASP.NET pages?  

The following namespaces are required to enable the use of databases in ASP.NET pages: * The System.Data namespace. * The System.Data.OleDb namespace (to use any data provider, such as Access, Oracle, or SQL) * The System.Data.SQLClient namespace (specifically to use SQL as the data provider)


12. Mention the namespace that is used to include .NET Data Provider for SQL server in .NET code.  

The System.Data.SqlClient namespace.


13. What is the base class for all arrays in C#?  

System.Array is the base class for all arrays in c#.


14. What is the use of using statement in C#?  

The using block is used to obtain a resource and use it and then automatically dispose of when the execution of block completed.


.Net Interview Question

PHP Interview Question

Java Interview Question

AngularJS Interview Questions