Question 1. What Is An Assembly?
Assemblies are the fundamental building blocks required for any utility to function within the .NET realm. They are partially compiled code libraries that shape the essential unit of deployment, versioning, activation scoping, reuse, and protection. Typically, assemblies offer a collection of sorts and sources that work collectively to form a logical unit of capability. They are the smallest deployable gadgets of code in .NET. Compared to the executable files assemblies are a long way extra reliable, greater relaxed, and smooth to manipulate. An assembly includes loads greater than the Microsoft Intermediate Language (MSIL) code that is compiled and run by way of the Common Language Runtime (CLR). In different words, you could say that an assembly is a hard and fast of one or greater modules and classes compiled in MSIL, and metadata that describes the meeting itself, in addition to the functionalities of the assembly lessons.
Question 2. What Is Namespace?
The namespace keyword is used to claim a scope. This namespace scope lets you organize code and gives you a way to create globally precise sorts.
Within a namespace, you could declare one or more of the subsequent kinds:
Whether or not you explicitly declare a namespace in a C# source record, the compiler provides a default namespace. This unnamed namespace, every so often known as the worldwide namespace, is found in every file. Any identifier in the worldwide namespace is available to be used in a named namespace.
Namespaces implicitly have public get right of entry to and this isn't modifiable.
It is feasible to outline a namespace in two or more declarations.E.G: namespace MyCompany.Proj1 elegance MyClass namespace MyCompany.Proj1 elegance MyClass1
Namespaces have the subsequent properties:
They prepare large code initiatives.
They are delimited by means of the usage of the . Operator.
The using directive obviates the requirement to specify the call of the namespace for each magnificence.
The worldwide namespace is the "root" namespace: worldwide::System will constantly talk over with the .NET Framework namespace System.
IBM Assembler Interview Questions
Question three. Explain About Using Directive?
The using directive has two makes use of:
To permit the use of kinds in a namespace so you do now not have to qualify the use of a type in that namespace
To create an alias for a namespace or a kind. This is known as a the usage of alias directive.
The scope of a the use of directive is limited to the file wherein it appears. Create a using alias to make it less complicated to qualify an identifier to a namespace or type.Namespaces come in categories: person-defined and device-defined. User-defined namespaces are namespaces described for your code.
Question 4. Name The Different Components Of An Assembly?
An assembly is a logical unit this is made up of the following four unique sorts of additives:
MSIL source code
Assembly Programming Tutorial
Question 5. What Is An Application Domain?
A boundary that the common language runtime establishes around items created within the equal software scope. Application domains assist isolate objects created in one utility from the ones created in different packages so that run-time behavior is predictable. Multiple software domain names can exist in a unmarried manner.
Assembly Programming Interview Questions
Question 6. What Are The Different Types Of Assemblies? Explain Them In Detail?
The following are the 2 varieties of assemblies:
Private Assembly - Refers to the meeting that is utilized by a single application. Private assemblies are kept in a local folder in which the purchaser application has been established.
Public or Shared Assembly - Refers to the meeting that is allowed to be shared by using multiple programs. A shared assembly should reside in Global Assembly Cache (GAC) with a strong call assigned to it.
For example, believe that you have created a DLL containing information approximately your enterprise good judgment. This DLL may be utilized by your purchaser application. In order to run the consumer application, the DLL need to be protected within the identical folder in which the consumer application has been installed. This makes the meeting private for your application. Now think that the DLL needs to be reused in one-of-a-kind packages. Therefore, as opposed to copying the DLL in each purchaser utility folder, it could be positioned within the global assembly cache the usage of the GAC device. These assemblies are called shared assemblies.
Question 7. What Is A Satellite Assembly?
Satellite assemblies are assemblies which can be used to deploy language and tradition unique resources for an software. In an application, a separate product ID is assigned to every language and a satellite assembly is established in a language unique sub-listing.
Question 8. What Is Global Assembly Cache?
Each computer wherein the commonplace language runtime is mounted has a device-wide code cache referred to as the worldwide assembly cache. The global assembly cache shops assemblies specially detailed to be shared through several applications on the computer.
You need to percentage assemblies via installing them into the worldwide assembly cache handiest while you need to. As a widespread guideline, preserve assembly dependencies private, and locate assemblies within the application directory until sharing an meeting is explicitly required. In addition, it isn't always important to put in assemblies into the global assembly cache to cause them to accessible to COM interop or unmanaged code.
There are several ways to deploy an assembly into the global meeting cache:
Use an installer designed to work with the worldwide assembly cache. This is the desired option for putting in assemblies into the worldwide meeting cache.
Use a developer tool called the Global Assembly Cache device (Gacutil.Exe), supplied by using the Windows Software Development Kit (SDK).
Use Windows Explorer to tug assemblies into the cache.
Assemblies deployed inside the international assembly cache ought to have a strong name. When an assembly is brought to the global assembly cache, integrity assessments are finished on all documents that make up the assembly. The cache plays these integrity checks to ensure that an meeting has not been tampered with, for instance, while a report has modified however the manifest does no longer replicate the change.
Question nine. Is Versioning Applicable To Private Assemblies?
No, versioning isn't always applicable to non-public assemblies as those assemblies live of their man or woman folders. Versioning may be carried out to GAC handiest.
Question 10. What Is Metadata?
An assembly metadata describes each facts kind and member described within the code. It shops the outline of an meeting, including name, version, culture, public key of an meeting along with the kinds exported, other assemblies structured on this meeting, and safety permissions had to run the software. In addition, it stores the description of types, which includes the name, visibility, base magnificence, interfaces carried out, and individuals, such as techniques, fields, homes, occasions, and nested types.
It additionally stores attributes. Metadata is saved in binary layout. Therefore, metadata of an meeting is sharable amongst programs that execute on various platforms. It also can be exported to other programs to provide facts approximately the services and various features of an software.
Question eleven. What Is Assembly Manifest?
Assemblies keep all their facts in a unique unit called the appear. Every assembly has a take place.
The followings are the contents of an Assembly Manifest:
Assembly call - Represents a text string that specifies the assembly's call.
Version number - Represents a prime and minor version quantity, as well as a revision and build quantity. The CL.R uses these numbers to put in force version coverage.
Culture - Represents statistics of the tradition or language, which the assembly helps. An meeting is a box of only resources containing culture- or language-unique information.
Strong call statistics - Represents the general public key from the writer, if a robust name is assigned to an assembly.
List of all files within the meeting - Represents a hash of every record contained in the meeting and a document call.
Type reference statistics - Represents the records used at the runtime to map a kind connection with the file that carries its assertion and implementation.
Information on referenced assemblies - Represents a listing of other assemblies which can be statically referenced by means of the assembly. Each reference consists of the names of dependent assemblies, assembly metadata (model, culture, operating system, and so forth), 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 13. What Is Native Image Generator?
The Native Image Generator (Ngen.Exe) is a device that creates a native photograph from an meeting and shops that image to native photograph cache on the pc. Whenever, an meeting is run, this native photo is mechanically used to collect the original assembly. In this manner, this device improves the overall performance of the managed application by loading and executing an meeting faster.
Note that local snap shots are documents that consist of compiled processor-specific system code. The Ngen.Exe tool installs those files on to the neighborhood computer.
Question 14. Name The Msil Disassembler Utility That Parses Any .Net 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 application (sn.Exe) enables in growing unique public-private key pair documents that are referred to as strong call documents and signing assemblies with them. It additionally lets in key management, signature generation, and signature verification.
Question sixteen. How Can Different Versions Of Private Assemblies Be Used In The Same Application Without A Re-build?
You can use different variations of private assemblies within the equal software with out a re-construct by specifying the assembly version in the AssemblyInfo.Cs or AssemblyInfo.Vb document.
Question 17. What Is Global Assembly Cache (gac) ?
GAC is a valuable repository (cache) in a device wherein assemblies are registered to percentage amongst various applications that execute on nearby or faraway machines. .NET Framework provides the GAC tool (gacutil.Exe software), that's used to view and exchange the content of GAC of a system. Adding new assemblies to GAC and casting off assemblies from GAC are some of the duties that can be accomplished by way of the use of the gacutil.Exe software. GAC can contain a couple of versions of the equal .NET meeting. CLR tests GAC for a requested assembly earlier than the use of information 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 put in an meeting in GAC by means of the usage of this command.
You can see all the assemblies mounted in the GAC using the GAC viewer, that is located on the <WinDrive>:<WinDir>meeting listing, wherein <WinDir> is home windows in Windows XP or home windows in Windows Vista or WinNT in Windows 2000. Apart from the list of assemblies, the meeting viewer also indicates relevant statistics, consisting of the worldwide meeting call, version, subculture, 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 stored 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 strong name wishes to be assigned to it for its unique identification. A robust name consists of an assembly's whole identity - the meeting call, model wide variety, and subculture facts of an meeting. A public key and a virtual signature, generated over the meeting, are also contained in a strong name. A robust name makes an assembly equal in GAC.
Question 20. What Is The Difference Between .Exe And .Dll Files?
It is an executable report, which can be run independently.
EXE is an out-system element, which means that it runs in a separate system.
It can not be reused in an application.
It has a chief characteristic.
It is Dynamic Link Library that is used as part of EXE or other DLLs. It cannot be run independently.
It runs in the software procedure memory, so it's far called as in-procedure component.
It can be reused in an software.
It does now not have a main feature.
Question 21. Which Utility Allows You To Reference An Assembly In An Application?
An assembly can be referenced by means of the usage of the gacutil.Exe software with the /r choice. The /r option calls for 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. (authentic/false)?