Advanced c# and .NET Interview Questions and Answers Part 6

1.) What is Serialization in .NET ?                                                                                            
A Serialization is the process of the converting an object into a stream of bytes and Deserialization is the opposite process of creating an object from a stream of bytes . The Serialization and Deserialization is mostly used  to transport objects (ex. during remoting applications).
2.) What are the types of  Serialization in .NET ?                                                                
There are two types of serialization used in .NET as given below:-
1.) Binary Serialization :- This serialization concepts preserves type fidelity that is used for preserving the state of an object between different invocations of an application.We can share an object between different application by serializing it to the clipboard.We can also serialize an object to a system,memory,disk ,over Network and others. 
2.) XML Serialization :- This XML Serialization concepts does not preserves type fidelity.
You already know,XML is an open standard and platform independent language. It is used  for sharing the data across the web .XML is technology that is used to share the the data with any application without any restriction.
The Microsoft uses XMLSerialization for the web services and uses  SOAPFormatter/  BinaryFormatter for remoting application.

3.) Why do we get error when try to Serialize a Hash Table?                                        
The XMLSerializer will refuse to serialize instance of any class that implements IDictionary.In SoapFormatter ,Hash table and BinaryFormatter do not have this restriction.

4.) What is active directory ?                                                                                                     
Active Directory is a directory service that developed for windows domain Networks.It includes:
  • Windows Server operating systems
  • Services
  • Process
5.) What is the Namespace used for active directory  in.NET ?                                     

Using System.DirectoryServices;

6.) What is the ADSI directory  in.NET ?                                                                               
ADSI means Active Directory service is Programmatic interface for microsoft windows Active Directory.It enables the applications to interact with different directories on a Network Using a single Interface .With the help of ADSI ,We can create applications that perform common administrative tasks.

7.) What is garbage collection in .NET ?                                                                                
You already know, Every program uses resources of one sort or another memory buffers ,database resources available for a program 's use.To use any of these resources,memory must be allocated to represent the type.
There are some steps to required to access a resource as given below:-
  1. It allocate memory for the type that represents the resources.
  2. It uses the resource by accessing the instance members of the type.  
  3. It initialize memory to set the initial state of the resource and o make resource usable.
  4. It is used to tear down the state of a resource to clean up .
  5. It is used to free the memory .
8.) What is the use of garbage collector in .NET ?                                                             
The garbage collector is completely divide the developer from tracking memory usage and knowing when to free memory.
You never free objects from the managed heap objects are automatically fired when they are no longer needed by the application.
 The garbage collector must perform a collection in order to free some memory .The garbage collector is a optimizing engine that determine best time to perform a collection .When it performs the necessary operations to get their memory.

9.) What is the Nmake tool ?                                                                                                       
The Nmake tool (Nmake.exe) is a 32 bit tool that we generally use to build projects based on commands contained is a .mak file.
nmake  - a all

10.) What is the Namespace in .NET ?                                                                                     
More Details...

11.) What is different between ref and out in .NET ?                                                         
An argument passed to a ref parameter must first be initialized .But out parameter argument does not have to be explicitly initialized before being passed to an out parameter.

12.) What is different between CONST and ReadOnly out in .NET ?                           
A const field can only be initialized at the declaration of the fields (ex const string sun;) . But a readonly field can be initialized either at declaration or in a constructor(ex. readonly int i = 0; ). These both fields meant for constant values. 
 A constant field is a compile time constant while readonly field can be used for run time constants as given below:-

readonly int i;
public msdtnet ()
i = 0;
public msdtnet (string s ,int a)
i =a;

Here i have used constructor for assigning the value in i variable.  
Public static readonly uint  msdot = (uint)(DateTime.Now.ticks);
This above code is possible with readonly field ,not with const field. 


Post a Comment

Powered by Blogger.