.Net Interview

Life is 10% what happens to us and 90% how we react to it. If you don't build your dream, someone else will hire you to help them build theirs.

.Net Interview

31. Define Overriding?
Overriding is a concept where a method in a derived class uses the same name, return type, and arguments as a method in its base class. In other words, if the derived class contains its own implementation of the method rather than using the method in the base class, the process is called overriding.
32. Can you use multiple inheritance in .NET?
.NET supports only single inheritance. However the purpose is accomplished using multiple interfaces.
33. What is an Interface?
An interface is a standard or contract that contains only the signatures of methods or events. The implementation is done in the class that inherits from this interface. Interfaces are primarily used to set a common standard or contract.
34. What are events and delegates?
An event is a message sent by a control to notify the occurrence of an action. However it is not known which object receives the event. For this reason, .NET provides a special type called Delegate which acts as an intermediary between the sender object and receiver object.
35. What is a component?
Component is a group of logically related classes and methods. A component is a class that implements the IComponent interface or uses a class that implements IComponent interface.
36. What is a connection pool?
A connection pool is a ‘collection of connections’ which are shared between the clients requesting one. Once the connection is closed, it returns back to the pool. This allows the connections to be reused.
37. What are functional and non-functional requirements?
Functional requirements defines the behavior of a system whereas non-functional requirements specify how the system should behave; in other words they specify the quality requirements and judge the behavior of a system.
E.g.
Functional – Display a chart which shows the maximum number of products sold in a region.
Non-functional – The data presented in the chart must be updated every 5 minutes.
38. What is an Assembly?
An assembly is a final deployable unit which can versioned and secured. The assembly can also be termed as a reusable collection of types and resources which work together as a logical unit of functionalities in .NET. .NET assemblies can be designed as executable (.EXE) or reusable component (.DLL). An assembly contains one or more managed types which can be made accessible to the unit or outside the unit.
39. Explain different types of Assemblies?
Assembly gets divided into four different parts.
1.) Manifest
2.) Type Metadata.
3.) Intermediate Language.
4.) Resources
Manifest – contains information about the assembly like Version of an assembly, the public key in case the assembly is shared assembly and the culture information. It also contains the security demands to verify this assembly. CLR uses the manifest to load the assembly.
Type Metadata – gives the complete information about the types which are available in the assembly like Class, Structure, Interface, Enum, and the methods, their parameters. The compilers automatically generate this metadata. You can make use of this Type Metadata to dynamically load the types using .NET Reflection.
Intermediate Language – It a code generated by the language specific compiler. It is also known as Machine independent code which can be compiled on one machine and can be deployed on another. CLR targets this code to JIT to convert it into processor depend on code which can be further executed.
Resources – Assembly can also contain the embedded resources like icons, images, string tables media clips.
You can see this information using a .NET framework utility called ILDASM.EXE
Microsoft .NET support different types of assemblies.

  • Private Assembly – Private Assemblies are the assemblies which are only known to the application to which it has been referenced. By default, the assemblies are always private when you create and reference them. The private assembly gets stored in the application folder which is using the assembly.
    Private assemblies are identified with the help of name of an assembly and version of an assembly. But the versions does not really come into the picture as the referenced assembly is in the same folder of your application.
  • Shared/Global/Public Assembly – Global/Public Assemblies are the assemblies which are shared across multiple applications. These assemblies are installed into Global Assembly Cache which acts as a shared area for all the assemblies.
    Global Assembly is identified with the four-part assembly name – Name of an Assembly, Version of an assembly, and Culture of an Assembly and Public Key Token of an assembly. Global Assembly Cache can contain different versions of an assembly. You can install a public/global assembly into Global Assembly Cache [GAC] using GACUTIL.EXE tool.
  • Satellite Assembly – Satellite Assemblies are used to build multi-lingual assemblies for applications. Satellite assemblies contain information about the cultures. Satellite assemblies are used to display the data in multiple languages according to Country/Region.
40. What is the global assembly cache (GAC)?
GAC is a machine-wide cache of assemblies that allows .NET applications to share libraries. GAC solves some of the problems associated with dll’s (DLL Hell).