Monday, 4 December 2017

.Net Framework Interview Questions with Answers Part2

Question 11. What is Assembly Manifest ?
Answer:The assembly which contains assembly Meta data that describes the assembly itself is known as manifest. Assembly manifest contains Assembly Name, Version Number, Culture, Strong name, List of files inside the assembly and Reference information.
Question 12 . What is Shared Assembly?
Answer:Shared Assemblies contain Common Libraries which are intended to be used by multiple applications. It can be shared by application.To make your assembly Shared,Make sure that u have registered in GAC(Global Assembly Cache).Global assembly cache can be used to avoid assembly overwriting.
Question 13. How  to view Assembly information?
Answer: By using Ildasm.exe, which is an MSIL Disassembler one can view attributes, references to other modules and assemblies.
Question 14. What are the different types of assembly?

Answer:
An Assembly contains metadata and manifest information. The reason for the emergence of assembly concept was to overcome the common "DLL Hell" problem in COM. The assembly contains all the code, resources, metadata and even version information. Metadata contains the details of every "type" inside the assembly. In addition to metadata, assemblies also have a special file called Manifest. It contains information about the current version of the assembly, culture information, public key token if available and other related information.

There are in all 2 different types of assemblies:
  1. Private Assembly
  2. Shared or Strong named assembly
Question 15. What is GAC?

Answer: The GAC is a shared location of computer where we can put an assembly so that it will be accessible from many locations, It means it can be accessible from another project or application.  the assembly should  be registered in the GAC,  otherwise the DLL hell problem may occur.

Question 16What is DLL hell?

Answer:DLL Hell is nothing but overwriting the dll in the registery. If two applications are installed on a single server, one installed First and the Second Installed Later and There is a dll with same name with different functionality used in both the applications, So in this case Application one works fine all the days until application two Installed on the machine. Once the Application two is installed containing the DLL with the same name as Application one Contains then In this case the application one Fails as the DLL from Application two overwrites the DLL of Application one in the Registery. So Application two works fine where as Application one Fails as the DLL is missing.
Question 17. What is a garbage collector?

Answer:
 It deallocates the object and free the memory space where the object is not in used .The Garbage Collector (GC) is the part of the .NET Framework that allocates and releases memory for your .NET applications. The Common Language Runtime (CLR) manages allocation and deallocation of a managed object in memory.
Question 18. How to invoke garbage collector programmatically?

Answer: To call garbage collector from a program, use code “ GC.Collect (); 
Question 19What is NameSpace ?
Answer: A namespace is a logical grouping of related classes and types. Every class should have a NameSpace. 
Question 20.  Explain the concept of strong names?
Answer:While using shared assemblies, in order to avoid name collisions strong names are used. Strong Names are based on private key cryptography, ie. private assemblies are simply given the same name as their main file name.

Question 21 How to add and remove a assembly from GAC?
Answer:To install assembly in Cache, use  Gacutil. To run Gacutil, goto "Visual Studio Command Prompt" and type "gacutil -i <assembly_name>", where (assembly_name) is the DLL name of the project. To uninstall assembly, type gacutil –u <assembly name> in  Visual Studio Command Prompt.
Question 22. What is Reflection?
Answer:Reflection is used to dynamically load a class, create object and invoke methods at runtime. It can also be used to read its own meta data to find assemblies, modules and type information at runtime.
Question 23.  What are the different type of JIT’s?
Answer: Different Types of JIT are
1) Pre-JIT -  Complies complete source code into native code at the time of deployment.
2) Econo-JIT - Complies methods that are called at run time.
3) Normal-JIT - Complies methods that are called at run time and get stored in cache. Next time when the same method is called, it will be taken from cache.
Question 24. What is Private Assembly?

Answer: Private assembly can be used by only one application. Private assembly will be stored in the specific application's directory or sub-directory.

Question 25.What is Unmanaged code?

Answer: Unmanaged code is code that is not run under .Net framework and it’s compiled to machine code, directly executed by operating system.

Example:VB, Win API, C and C++,COM components etc. codes are examples of unman aged code

No comments:

Post a Comment

apply function in R

1) apply function: It takes 3 arguments matrix,margin and function.. Example: m<-matrix(c(1,2,3,4),nrow=2,ncol=2) m #1 indicates it is ap...