Top 100+ . Net Interview Questions And Answers
Question 1. What Is An Assembly?
Assemblies are the fundamental constructing blocks required for any utility to function in the .NET realm. They are partly compiled code libraries that shape the fundamental unit of deployment, versioning, activation scoping, reuse, and protection. Typically, assemblies offer a collection of kinds and resources that work collectively to form a logical unit of functionality. They are the smallest deployable units of code in .NET. Compared to the executable files assemblies are a long way greater dependable, extra comfortable, and smooth to manage. An assembly includes a lot greater than the Microsoft Intermediate Language (MSIL) code that is compiled and run through the Common Language Runtime (CLR). In other words, you can say that an meeting is a set of 1 or more modules and training compiled in MSIL, and metadata that describes the meeting itself, as well as the functionalities of the meeting instructions.
Question 2. What Is Namespace?
The namespace key-word is used to claim a scope. This namespace scope lets you arrange code and offers you a manner to create globally unique types.
Within a namespace, you could declare one or more of the following types:
Whether or no longer you explicitly claim a namespace in a C# supply record, the compiler adds a default namespace. This unnamed namespace, sometimes called the global namespace, is found in each report. Any identifier inside the global namespace is available for use in a named namespace.
Namespaces implicitly have public get entry to and this is not modifiable.
It is feasible to outline a namespace in two or greater declarations.E.G: namespace MyCompany.Proj1 class MyClass namespace MyCompany.Proj1 magnificence MyClass1
Namespaces have the following properties:
They organize large code initiatives.
They are delimited by way of the use of the . Operator.
The using directive obviates the requirement to specify the name of the namespace for each magnificence.
The global namespace is the "root" namespace: worldwide::System will continually discuss with the .NET Framework namespace System.
IBM Assembler Interview Questions
Question three. Explain About Using Directive?
The the use of directive has two uses:
To permit the use of sorts in a namespace so you do now not must qualify the usage of a kind in that namespace
To create an alias for a namespace or a type. This is called a using alias directive.
The scope of a using directive is limited to the document in which it appears. Create a the usage of alias to make it less complicated to qualify an identifier to a namespace or kind.Namespaces are available classes: consumer-described and system-defined. User-defined namespaces are namespaces described to your code.
Question four. Name The Different Components Of An Assembly?
An meeting is a logical unit this is made from the following four extraordinary types of components:
MSIL source code
Assembly Programming Tutorial
Question five. What Is An Application Domain?
A boundary that the not unusual language runtime establishes round items created in the equal application scope. Application domain names assist isolate items created in one software from the ones created in different applications so that run-time conduct is predictable. Multiple software domain names can exist in a unmarried technique.
Assembly Programming Interview Questions
Question 6. What Are The Different Types Of Assemblies? Explain Them In Detail?
The following are the 2 types of assemblies:
Private Assembly - Refers to the meeting that is used by a single utility. Private assemblies are saved in a nearby folder wherein the purchaser utility has been established.
Public or Shared Assembly - Refers to the meeting that is allowed to be shared by means of more than one programs. A shared meeting ought to reside in Global Assembly Cache (GAC) with a robust call assigned to it.
For example, imagine which you have created a DLL containing records approximately your commercial enterprise good judgment. This DLL may be used by your consumer utility. In order to run the consumer application, the DLL must be included in the identical folder wherein the patron application has been established. This makes the meeting private on your utility. Now think that the DLL needs to be reused in extraordinary applications. Therefore, rather than copying the DLL in each patron utility folder, it could be located within the global assembly cache the usage of the GAC device. These assemblies are known as shared assemblies.
Question 7. What Is A Satellite Assembly?
Satellite assemblies are assemblies which can be used to installation language and way of life precise resources for an software. In an software, a separate product ID is assigned to every language and a satellite tv for pc meeting is installed in a language unique sub-listing.
Question eight. What Is Global Assembly Cache?
Each pc where the common language runtime is established has a device-wide code cache called the global meeting cache. The international assembly cache shops assemblies specifically designated to be shared by using several applications at the laptop.
You need to share assemblies by installing them into the worldwide assembly cache handiest whilst you need to. As a standard guideline, maintain meeting dependencies private, and find assemblies in the application directory until sharing an meeting is explicitly required. In addition, it isn't always essential to put in assemblies into the worldwide meeting cache to lead them to reachable to COM interop or unmanaged code.
There are several approaches to install an meeting into the worldwide meeting cache:
Use an installer designed to work with the worldwide assembly cache. This is the preferred option for putting in assemblies into the worldwide assembly cache.
Use a developer device called the Global Assembly Cache tool (Gacutil.Exe), provided through the Windows Software Development Kit (SDK).
Use Windows Explorer to pull assemblies into the cache.
Assemblies deployed inside the worldwide assembly cache should have a robust call. When an assembly is added to the worldwide assembly cache, integrity checks are carried out on all documents that make up the assembly. The cache performs these integrity assessments to ensure that an assembly has now not been tampered with, for instance, whilst a record has changed but the manifest does no longer replicate the exchange.
Question 9. Is Versioning Applicable To Private Assemblies?
No, versioning isn't relevant to personal assemblies as these assemblies are living of their man or woman folders. Versioning may be carried out to GAC most effective.
Question 10. What Is Metadata?
An assembly metadata describes each statistics type and member defined in the code. It stores the outline of an meeting, which includes call, model, lifestyle, public key of an meeting together with the sorts exported, other assemblies established on this meeting, and security permissions had to run the utility. In addition, it shops the outline of kinds, consisting of the name, visibility, base elegance, interfaces implemented, and participants, which include strategies, fields, properties, activities, and nested kinds.
It also shops attributes. Metadata is saved in binary layout. Therefore, metadata of an assembly is sharable among programs that execute on numerous systems. It can also be exported to different applications to give facts approximately the offerings and various features of an software.
Question eleven. What Is Assembly Manifest?
Assemblies hold all their data in a unique unit known as the take place. Every meeting has a appear.
The followings are the contents of an Assembly Manifest:
Assembly name - Represents a textual content string that specifies the meeting's call.
Version wide variety - Represents a prime and minor version range, as well as a revision and construct range. The CL.R uses those numbers to implement model coverage.
Culture - Represents data of the tradition or language, which the meeting supports. An assembly is a container of only sources containing tradition- or language-unique information.
Strong name records - Represents the public key from the publisher, if a robust name is assigned to an assembly.
List of all documents within the assembly - Represents a hash of each file contained inside the assembly and a document name.
Type reference records - Represents the facts used at the runtime to map a kind reference to the report that carries its declaration and implementation.
Information on referenced assemblies - Represents a list of different assemblies which are statically referenced by the assembly. Each reference consists of the names of established assemblies, assembly metadata (version, tradition, working device, and so on), and public key, if the assembly is strong named.
Question 12. What Is The Value Of The Copy Local Property When You Add An Assembly In The Gac?
IBM Assembler Interview Questions
Question thirteen. What Is Native Image Generator?
The Native Image Generator (Ngen.Exe) is a tool that creates a local photo from an meeting and stores that photo to native photograph cache on the computer. Whenever, an meeting is administered, this local image is robotically used to bring together the original assembly. In this manner, this tool improves the overall performance of the controlled software by way of loading and executing an assembly quicker.
Note that native photographs are files that encompass compiled processor-specific machine code. The Ngen.Exe tool installs those files directly to the local pc.
Question 14. Name The Msil Disassembler Utility That Parses Any .Internet Framework Assembly And Shows The Information In Human Readable Format?
The Ildasm.Exe utility.
Question 15. What Is The Significance Of The Strong Name Tool?
The Strong Name software (sn.Exe) helps in creating unique public-personal key pair documents which are referred to as sturdy name files and signing assemblies with them. It additionally lets in key control, signature generation, and signature verification.
Question 16. How Can Different Versions Of Private Assemblies Be Used In The Same Application Without A Re-construct?
You can use distinct versions of private assemblies inside the same utility with out a re-construct with the aid of specifying the meeting version within the AssemblyInfo.Cs or AssemblyInfo.Vb file.
Question 17. What Is Global Assembly Cache (gac) ?
GAC is a principal repository (cache) in a machine in which assemblies are registered to proportion amongst various packages that execute on neighborhood or remote machines. .NET Framework affords the GAC tool (gacutil.Exe software), which is used to view and trade the content of GAC of a device. Adding new assemblies to GAC and eliminating assemblies from GAC are a number of the tasks that can be performed by means of the use of the gacutil.Exe software. GAC can incorporate a couple of versions of the same .NET assembly. CLR tests GAC for a requested meeting before the usage of statistics of configuration files.
The gacutil.Exe /i <assembly name> - is the command that is used to install an meeting in GAC. Users use the Command Prompt of Visual Studio to install an meeting in GAC through the use of this command.
You can see all the assemblies established in the GAC using the GAC viewer, that's located at the <WinDrive>:<WinDir>meeting listing, where <WinDir> is home windows in Windows XP or windows in Windows Vista or WinNT in Windows 2000. Apart from the listing of assemblies, the meeting viewer also suggests relevant facts, which include the worldwide assembly call, version, culture, and the general public key token.
Question 18. Where Is The Information Regarding The Version Of The Assembly Stored?
Information for the model of assembly is saved inside the assembly appear.
Assembly Programming Interview Questions
Question 19. Discuss The Concept Of Strong Names?
Whenever, an meeting is deployed in GAC to make it shared, a sturdy call wishes to be assigned to it for its specific identification. A sturdy name includes an assembly's entire identity - the assembly call, version range, and subculture information of an meeting. A public key and a virtual signature, generated over the meeting, also are contained in a sturdy name. A strong call makes an assembly identical in GAC.
Question 20. What Is The Difference Between .Exe And .Dll Files?
It is an executable record, which can be run independently.
EXE is an out-method element, which means that that it runs in a separate process.
It cannot be reused in an utility.
It has a first-rate characteristic.
It is Dynamic Link Library this is used as part of EXE or different DLLs. It cannot be run independently.
It runs within the application process reminiscence, so it's far known as as in-procedure element.
It may be reused in an software.
It does not have a major feature.
Question 21. Which Utility Allows You To Reference An Assembly In An Application?
An meeting can be referenced by using using the gacutil.Exe software with the /r choice. The /r alternative requires a reference kind, a reference ID, and an outline.
Question 22. The Assemblyinfo.Cs File Stores The Assembly Configuration Information And Other Information, Such As The Assembly Name, Version, Company Name, And Trademark Information. (actual/false)?