English speaking and learning Interview Questions and Answers Programs C# Concept OOPS Concept JOBS

Saturday, September 9, 2017


Question 1. What is an application domain?
Answer: An Application Domain is a logical container for a set of assemblies in which an executable is hosted. As you have seen, a single process may contain multiple Application Domains, each of which is hosting a .NET executable. The first appdomain created when the CLR is initialized is called the default AppDomain and this default one is destroyed when the Windows process is terminated.

  • An AppDomain can be independently secured.
  • An AppDomain can be unloaded.
  • Independently configured.
  • No mutual intervention by multiple appdomains.
  • Performance

How does an AppDomain get created
The AppDomain class is used to create and terminate Application Domains, load and unload assemblies and types and enumerates assemblies and threads in a domain. 
some useful methods of the AppDomain class:
  1. CreateDomain() It allows us to create a new Application Domain.
  2. CreateInstance() Creates an instance of type in an external assembly.
  3. ExecuteAssembly() It executes an *.exe assembly in the Application Domain.
  4. Load() This method dynamically loads an assembly into the current app domain.
  5. UnLoad() It allows us to unload a specified AppDomain within a given process.
  6. GetCurrentThread() Returns the ID of the active thread in the current Application Domain.
 the AppDomain class also defined as a set of properties that can be useful when you wish to monitor the activity of a given Application Domain.
  1. CurrentDomain Gets the Application Domain for the currently executing thread.
  2. FriendlyName Gets the friendly name of the current Application Domain.
  3. SetupInformation Get the configuration details for a given Application Domain.
  4. BaseDirectory Gets the directory path that the assembly resolver uses to probe for assemblies.

Question 2. What is an assembly?
Answer: An Assembly is a basic building block of .NET Framework applications. It is basically compiled code that can be executed by the CLR. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An Assembly can be a DLL or exe depending upon the project that we choose.

Assemblies are basically the following two types:
  1. Private Assembly
  2. Shared Assembly
contents of assembly
  1. An Assembly is a basic unit of application deployment and versioning.
  2. An Assembly is also called the building block of a .NET application.
  3. An Assembly is either a .exe or .dll file.
An Assembly structure consists of the following parts:
  1. Assembly manifest (name, language and version).
  2. CIL code (logic part).
  3. Type information (Datatype).
  4. Resources.

Question 3 -What are the main components of .NET Framework?
Answer - .NET Framework provides enormous advantages to software developers in comparison to the advantages provided by other platforms. Microsoft has united various modern as well as existing technologies of software development in .NET Framework. These technologies are used by developers to develop highly efficient applications for modern as well as future business needs. The following are the key components of .NET Framework:
  • .NET Framework Class Library
  • Common Language Runtime
  • Dynamic Language Runtimes (DLR)
  • Application Domains
  • Runtime Host
  • Common Type System
  • Metadata and Self-Describing Components
  • Cross-Language Interoperability
  • .NET Framework Security
  • Profiling
  • Side-by-Side Execution

Question 4 -Differentiate between managed and unmanaged code?
Answer -Managed code is the code that is executed directly by the CLR instead of the operating system. The code compiler first compiles the managed code to intermediate language (IL) code, also called as MSIL code. This code doesn't depend on machine configurations and can be executed on different machines.
Unmanaged code is the code that is executed directly by the operating system outside the CLR environment. It is directly compiled to native machine code which depends on the machine configuration.
In the managed code, since the execution of the code is governed by CLR, the runtime provides different services, such as garbage collection, type checking, exception handling, and security support. These services help provide uniformity in platform and language-independent behavior of managed code applications. 
In the unmanaged code, the allocation of memory, type safety, and security is required to be taken care of by the developer. If the unmanaged code is not properly handled, it may result in memory leak.
 Examples of unmanaged code are ActiveX components and Win32 APIs that execute beyond the scope of native CLR.

Question 5  -What is the difference between Namespace and Assembly
Answer Namespace:  
1. It is a Collection of names wherein each name is Unique.
2. They form the logical boundary for a Group of classes.
3. Namespace must be specified in Project-Properties.
1. It is an Output Unit. It is a unit of Deployment & a unit of versioning. Assemblies contain MSIL code.
2. Assemblies are Self-Describing. [e.g. metadata,manifest]
3. An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or by code outside that unit.

You may also like

No comments :

Post a Comment