Tuesday 15 March 2011

Assembly interview Questions

What is Assembly?
Assembly is the building blocks of the .NET framework. They are the logical grouping of the functionality in a physical file.

What are the different components of Assembly?

Following are the main components of assembly:

1. Manifest : It contains assembly information like Assembly version, security, reference to other assemblies.
2. Type Metadata : Provides information about types defined in assembly like classes, interface, methods, properties.
3. MSIL Code : It is CPU independent set of instruction that can be efficiently converted into native code.
4. Resources  : Resources like .jpg and .bmp files are stored.

Which tool is used to deploy an assembly, so as the assembly is available to all the application?

The GacUtil.exe is the tool, which allows us to add any assembly to the windows GAC (Global Assembly Catche).

What is Namespace?

It is logical grouping of all the classes and methods inside it.

What is Difference between NameSpace and Assembly?

a. Assembly is physical grouping of  logical units whereas Namespace is the logically grouping of classes.
b. Namespace can span multiple assembly.


Where the version information of assembly is stored?

Version information is stored in assembly in manifest.

Is versioning applicable to private assemblies?

No, Versioning concept is only applicable to global assembly cache (GAC) as private assembly lie in there individual folders.

What is concept of strong names ? Twist :- How do we generate strong names  or what is the process of generating strong names?

Strong Name is only needed when  we need to deploy assembly in GAC.Strong Names helps GAC to differentiate between two versions.Strong names use public key cryptography (PKC) to ensure that no one can spoof it.PKC use public key and private key concept.

Following are the step to generate a strong name and sign a assembly :-
a. Go to “Visual Studio Command Prompt”.
b. After you are in command prompt type sn.exe -k “c:\test.snk”.
c. Add the strong name in AssemblyInfo.cs page of the project.
  [assembly: AssemblyKeyFile(@"e:\mykey.snk")]
d. Add the assembly to Cache: in command prompt  type:
gacutil/i- path of assembly

path of assembly = path of the dll file from the bin/debug folder of the project
What is the satellite assemblies?

In a multilingual or multi-cultural application, the localized assemblies, which contain language specific instructions that modify the core application, are kept separately and they are called satellite assemblies.


3 comments:

  1. Very good questions of Exception. Thanks a lot..

    ReplyDelete
  2. really useful information...
    Thanks a lot...
    If any body have .net notes or any useful information like interview qtns please send to my mail id
    kiran_kumar_333@yahoo.co.in
    please do the needful

    ReplyDelete
  3. really imp interview question/answer......

    ReplyDelete