YouTube Icon

Interview Questions.

Top 22 .net Assemblies Interview Questions - Jul 25, 2022

fluid

Top 22 .net Assemblies Interview Questions

Q1. What Is Assembly Manifest?

Assemblies keep all their information in a special unit known as the take place. Every assembly has a show up.

The followings are the contents of an Assembly Manifest:

Assembly name - Represents a text string that specifies the assembly's call.

Version range - Represents a primary and minor model quantity, as well as a revision and construct range. The CL.R uses those numbers to put in force model coverage.

Culture - Represents statistics of the way of life or language, which the assembly helps. An assembly is a field of handiest assets containing tradition- or language-specific statistics.

Strong call records - Represents the public key from the writer, if a sturdy call is assigned to an assembly.

List of all files in the meeting - Represents a hash of each file contained within the meeting and a report call.

Type reference data - Represents the statistics used on the runtime to map a kind reference to the document that includes its statement and implementation.

Information on referenced assemblies - Represents a list of other assemblies which are statically referenced via the meeting. Each reference includes the names of based assemblies, meeting metadata (version, tradition, running gadget, and so forth), and public key, if the assembly is strong named.

Q2. Name The Different Components Of An Assembly?

An meeting is a logical unit this is made of the subsequent 4 exceptional styles of components:

Assembly happen

MSIL supply code

Type metadata

Resources

Q3. What Are The Different Types Of Assemblies? Explain Them In Detail?

The following are the 2 varieties of assemblies:

Private Assembly - Refers to the assembly this is utilized by a single utility. Private assemblies are stored in a neighborhood folder in which the patron software has been hooked up.

Public or Shared Assembly - Refers to the meeting this is allowed to be shared with the aid of more than one applications. A shared meeting need to live in Global Assembly Cache (GAC) with a sturdy name assigned to it.

For instance, imagine which you have created a DLL containing statistics about your enterprise logic. This DLL may be utilized by your client software. In order to run the purchaser application, the DLL should be covered within the identical folder wherein the client software has been set up. This makes the meeting private to your application. Now assume that the DLL wishes to be reused in unique applications. Therefore, rather than copying the DLL in each purchaser utility folder, it could be placed inside the international assembly cache the use of the GAC tool. These assemblies are called shared assemblies.

Q4. What Is An Assembly?

Assemblies are the fundamental building blocks required for any application to characteristic inside the .NET realm. They are partially compiled code libraries that form the essential unit of deployment, versioning, activation scoping, reuse, and safety. Typically, assemblies provide a collection of types and resources that paintings together to shape a logical unit of capability. They are the smallest deployable gadgets of code in .NET. Compared to the executable files assemblies are far more reliable, greater comfortable, and smooth to manage. An assembly incorporates loads more than the Microsoft Intermediate Language (MSIL) code this is compiled and run by way of the Common Language Runtime (CLR). In different phrases, you may say that an assembly is a hard and fast of 1 or greater modules and lessons compiled in MSIL, and metadata that describes the meeting itself, in addition to the functionalities of the meeting classes.

Q5. What Is Global Assembly Cache?

Each computer where the commonplace language runtime is set up has a system-extensive code cache called the global meeting cache. The worldwide assembly cache stores assemblies in particular designated to be shared via numerous packages on the pc.

You have to share assemblies by way of installing them into the worldwide assembly cache best whilst you want to. As a general tenet, preserve meeting dependencies non-public, and find assemblies within the software directory except sharing an meeting is explicitly required. In addition, it isn't always important to install assemblies into the global meeting cache to lead them to handy to COM interop or unmanaged code.

There are numerous ways to installation an assembly into the worldwide meeting cache:

Use an installer designed to paintings with the global meeting cache. This is the desired choice for installing 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 tug assemblies into the cache.

Assemblies deployed inside the international meeting cache must have a sturdy name. When an assembly is brought to the worldwide assembly cache, integrity assessments are executed on all files that make up the assembly. The cache plays these integrity tests to make sure that an meeting has not been tampered with, for instance, while a report has modified but the occur does no longer mirror the trade.

Q6. Name The Msil Disassembler Utility That Parses Any .Net Framework Assembly And Shows The Information In Human Readable Format?

The Ildasm.Exe utility.

Q7. Discuss The Concept Of Strong Names?

Whenever, an meeting is deployed in GAC to make it shared, a sturdy name wishes to be assigned to it for its precise identity. A robust name consists of an meeting's complete identification - the assembly name, model range, and way of life facts of an assembly. A public key and a virtual signature, generated over the assembly, also are contained in a strong name. A sturdy name makes an meeting equal in GAC.

Q8. What Is Global Assembly Cache (gac) ?

GAC is a central repository (cache) in a gadget wherein assemblies are registered to share among diverse packages that execute on nearby or faraway machines. .NET Framework provides the GAC tool (gacutil.Exe software), that is used to view and exchange the content of GAC of a machine. Adding new assemblies to GAC and eliminating assemblies from GAC are some of the responsibilities that may be carried out with the aid of the use of the gacutil.Exe application. GAC can contain a couple of variations of the equal .NET meeting. CLR checks GAC for a asked meeting before using facts of configuration documents.

The gacutil.Exe /i <assembly name> - is the command that is used to put in an meeting in GAC. Users use the Command Prompt of Visual Studio to put in an meeting in GAC by using the use of this command.

You can see all the assemblies hooked up within the GAC the use of the GAC viewer, that's located on the <WinDrive>:<WinDir>assembly listing, wherein <WinDir> is home windows in Windows XP or windows in Windows Vista or WinNT in Windows 20@Apart from the list of assemblies, the assembly viewer also shows relevant data, which include the worldwide assembly name, model, culture, and the public key token.

Q9. What Is The Significance Of The Strong Name Tool?

The Strong Name software (sn.Exe) facilitates in developing unique public-private key pair documents which might be referred to as sturdy name files and signing assemblies with them. It also lets in key management, signature era, and signature verification.

Q10. Where Is The Information Regarding The Version Of The Assembly Stored?

Information for the version of meeting is stored within the assembly occur.

Q11. How Can Different Versions Of Private Assemblies Be Used In The Same Application Without A Re-build?

You can use specific versions of private assemblies within the identical utility with out a re-construct by using specifying the assembly model in the AssemblyInfo.Cs or AssemblyInfo.Vb file.

Q12. Which Utility Allows You To Reference An Assembly In An Application?

An assembly may be referenced by way of the usage of the gacutil.Exe software with the /r option. The /r alternative calls for a reference kind, a reference ID, and an outline.

Q13. What Is Namespace?

The namespace keyword is used to claim a scope. This namespace scope helps you to arrange code and offers you a manner to create globally precise kinds.

Within a namespace, you can declare one or extra of the subsequent sorts:

Another namespace

Class

Interface

Struct

Enum

Delegate

Whether or no longer you explicitly declare a namespace in a C# source record, the compiler adds a default namespace. This unnamed namespace, occasionally referred to as the worldwide namespace, is present in every report. Any identifier inside the global namespace is to be had to be used in a named namespace.

Namespaces implicitly have public get entry to and this is not modifiable.

It is possible to define a namespace in two or extra declarations.E.G: namespace MyCompany.Proj1 elegance MyClass   namespace MyCompany.Proj1 elegance MyClass1  

Namespaces have the subsequent houses:

They prepare large code projects.

They are delimited by way of the use of the . Operator.

The the use of directive obviates the requirement to specify the name of the namespace for each magnificence.

The global namespace is the "root" namespace: global::System will continually discuss with the .NET Framework namespace System.

Q14. Is Versioning Applicable To Private Assemblies?

No, versioning isn't applicable to non-public assemblies as these assemblies are living in their individual folders. Versioning may be applied to GAC most effective.

Q15. What Is The Value Of The Copy Local Property When You Add An Assembly In The Gac?

False.

Q16. What Is A Satellite Assembly?

Satellite assemblies are assemblies which might be used to install language and culture unique sources for an utility. In an application, a separate product ID is assigned to each language and a satellite assembly is set up in a language unique sub-listing.

Q17. Explain About Using Directive?

The the use of directive has  uses:

To allow the usage of kinds in a namespace so that you do now not need to qualify using a kind in that namespace

To create an alias for a namespace or a kind. This is referred to as a using alias directive.

The scope of a the usage of directive is limited to the file wherein it seems. Create a the usage of alias to make it simpler to qualify an identifier to a namespace or type.Namespaces are available  classes: consumer-defined and machine-described. User-defined namespaces are namespaces described to your code.

Q18. What Is An Application Domain?

A boundary that the commonplace language runtime establishes around objects created in the same utility scope. Application domains help isolate items created in one software from the ones created in other applications in order that run-time behavior is predictable. Multiple application domain names can exist in a unmarried manner.

Q19. What Is Metadata?

An meeting metadata describes every information kind and member described in the code. It shops the outline of an meeting, including name, version, way of life, public key of an assembly along side the types exported, different assemblies structured in this meeting, and safety permissions needed to run the application. In addition, it stores the outline of types, inclusive of the call, visibility, base magnificence, interfaces applied, and members, which include methods, fields, residences, occasions, and nested kinds.

It also stores attributes. Metadata is saved in binary layout. Therefore, metadata of an meeting is sharable amongst programs that execute on various systems. It can also be exported to other programs to give facts about the offerings and various functions of an software.

Q20. What Is The Difference Between .Exe And .Dll Files?

EXE:

It is an executable file, which can be run independently.

EXE is an out-manner component, which me that it runs in a separate system.

It cannot be reused in an application.

It has a prime characteristic.

DLL:

It is Dynamic Link Library this is used as a part of EXE or different DLLs. It can't be run independently.

It runs within the application system memory, so it's far known as as in-manner factor.

It can be reused in an software.

It does now not have a main function.

Q21. What Is Native Image Generator?

The Native Image Generator (Ngen.Exe) is a tool that creates a local image from an meeting and stores that photo to local photograph cache at the pc. Whenever, an assembly is run, this local picture is automatically used to bring together the unique assembly. In this manner, this tool improves the overall performance of the managed software with the aid of loading and executing an meeting faster.

Note that local pix are documents that encompass compiled processor-specific machine code. The Ngen.Exe device installs these files on to the local laptop.

Q22. The Assemblyinfo.Cs File Stores The Assembly Configuration Information And Other Information, Such As The Assembly Name, Version, Company Name, And Trademark Information. (true/fake)?

True.




CFG