.Net Framework Interview Questions

By | May 5, 2014
  1. What is the base class of .NET?
  2. Explain assemblies.
  3. Name some of the languages .NET support?
  4. ADO.NET features? Benefits? Drawbacks?
  5. How many types of exception handlers are there in .NET?
  6. Difference between Panel and GroupBox classes?
  7. What is the base class of Button control?
  8. What is Response object? How is it related to ASP’s Response object?
  9. What is IIS? Have you used it?
  10. Main differences between ASP and ASP.NET.


What is the purpose of XML Namespaces?

An XML Namespace is a collection of element types and attribute names. It consists of 2 parts 1) The first part is the URI used to identify the namespace 2) The second part is the element type or attribute name itself. Together they form a unique name. The various purpose of XML Namespace are 1. Combine fragments from different documents without any naming conflicts. (See example below.) 2. Write reusable code modules that can be invoked for specific elements and attributes. Universally unique names guarantee that such modules are invoked only for the correct elements and attributes. 3. Define elements and attributes that can be reused in other schemas or instance documents without fear of name collisions. For example, you might use XHTML elements in a parts catalog to provide part descriptions. Or you might use the nil attribute defined in XML Schemas to indicate a missing value. < Department >      < Name >DVS1< /Name >      < addr:Address xmlns:addr=”http://www.tu-darmstadt.de/ito/addresses” >         < addr:Street >Wilhelminenstr. 7< /addr:Street >         < addr:City >Darmstadt< /addr:City >         < addr:State >Hessen< /addr:State >         < addr:Country >Germany< /addr:Country >         < addr:PostalCode >D-64285< /addr:PostalCode >      < /addr:Address >      < serv:Server xmlns:serv=”http://www.tu-darmstadt.de/ito/servers” >         < serv:Name >OurWebServer< /serv:Name >         < serv:Address >< /serv:Address >      < /serv:Server >   < /Department >

What is difference between MetaData and Manifest ?
Metadata and Manifest forms an integral part of an assembly( dll / exe ) in .net framework . Out of which Metadata is a mandatory component , which as the name suggests gives the details about various components of IL code viz : Methods , properties , fields , class etc. Essentially Metadata maintains details in form of tables like Methods Metadata tables , Properties Metadata tables , which maintains the list of given type and other details like access specifier , return type etc. Now Manifest is a part of metadata only , fully called as “manifest metadata tables” , it contains the details of the references needed by the assembly of any other external assembly / type , it could be a custom assembly or standard System namespace . Now for an assembly that can independently exists and used in the .Net world both the things ( Metadata with Manifest ) are mandatory , so that it can be fully described assembly and can be ported anywhere without any system dependency . Essentially .Net framework can read all assembly related information from assembly itself at runtime . But for .Net modules , that can’t be used independently , until they are being packaged as a part of an assembly , they don’t contain Manifest but their complete structure is defined by their respective metadata . Ultimately . .Net modules use Manifest Metadata tables of parent assembly which contain them .

What is the use of Internal keyword?
Internal keyword is one of the access specifier available in .Net framework , that makes a type visible in a  given assembly , for e.g : a single dll can contain multiple modules , essentially a multi file assembly , but it forms a single binary component , so any type with internal keyword will be visible throughout the assembly and can be used in any of the modules .

What actually happes when you add a something to arraylistcollection ?
Following things will happen :
Arraylist is a dynamic array class in c# in System.Collections namespace derived from interfaces – ICollection , IList , ICloneable , IConvertible  . It terms of in memory structure following is the implementation .a. Check up the total space if there’s any free space on the declared list . b. If yes add the new item and increase count by 1 . c. If No Copy the whole thing to a temporary Array of Last Max. Size . d. Create new Array with size ( Last Array Size + Increase Value ) e. Copy back values from temp and reference this new array as original array . f. Must doing Method updates too , need to check it up .

What is Boxing and unboxing? Does it occure automaatically or u need to write code to box and unbox?
Boxing – Process of converting a System.ValueType to Reference Type , Mostly base class System.Object type and allocating it memory on Heap .Reverse is unboxing , but can only be done with prior boxed variables. Boxing is always implicit but Unboxing needs to be explicitly done via casting , thus ensuring the value type contained inside .

How Boxing and unboxing occures in memory?
Boxing converts value type to reference type , thus allocating memory on Heap . Unboxing converts already boxed reference types to value types through explicit casting , thus  allocating memory on stack .

Why only boxed types can be unboxed?
Unboxing is the process of converting a Reference type variable to Value type and thus allocating memory on the stack . It happens only to those Reference type variables that have been earlier created by Boxing of a Value Type , therefore internally they contain a value type , which can be obtained through explicit casting . For any other Reference type , they don’t internally contain a Value type to Unboxed via explicit casting . This is why only boxed types can be unboxed .

Leave a Reply