FAQ'S ON DOT NET FRAME WORK PART SIX

1• What are the types of assemblies?

There are four types of assemblies in .NET:

Static assemblies

These are the .NET PE files that you create at compile time.

Dynamic assemblies

These are PE-formatted, in-memory assemblies that you dynamically create at runtime using the classes in the System.Reflection.Emit namespace.

Private assemblies

These are static assemblies used by a specific application.

Public or shared assemblies

These are static assemblies that must have a unique shared name and can be used by any application.

An application uses a private assembly by referring to the assembly using a static path or through an XML-based application configuration file. While the CLR doesn't enforce versioning policies-checking whether the correct version is used-for private assemblies, it ensures that an application uses the correct shared assemblies with which the application was built.

Thus, an application uses a specific shared assembly by referring to the specific shared assembly, and the CLR ensures that the correct version is loaded at runtime.
In .NET, an assembly is the smallest unit to which you can associate a version number;

2• What are delegates?where are they used ?

A delegate defines a reference type that can be used to encapsulate a method with a specific signature. A delegate instance encapsulates a static or an instance method. Delegates are roughly similar to function pointers in C++; however, delegates are type-safe and secure.

3• When do you use virutal keyword?.

When we need to override a method of the base class in the sub class, then we give the virtual keyword in the base class method. This makes the method in the base class to be overridable. Methods, properties, and indexers can be virtual, which means that their implementation can be overridden in derived classes.

4• What are class access modifiers ?

Access modifiers are keywords used to specify the declared accessibility of a member or a type. This section introduces the four access modifiers:

• Public - Access is not restricted.

• Protected - Access is limited to the containing class or types derived from the containing class.

• Internal - Access is limited to the current assembly.

• Protected inertnal - Access is limited to the current assembly or types derived • from the containing class.

• Private - Access is limited to the containing type.

5• What is Value type and refernce type in .Net?

Value Type : A variable of a value type always contains a value of that type. The assignment to a variable of a value type creates a copy of the assigned value, while the assignment to a variable of a reference type creates a copy of the reference but not of the referenced object.

The value types consist of two main categories:

* Stuct Type

* Enumeration Type

Reference Type :Variables of reference types, referred to as objects, store references to the actual data. This section introduces the following keywords used to declare reference types:

* Class
* Interface
* Delegate
This section also introduces the following built-in reference types:
* object
* string

6• What is the difference between structures and enumeration?

Unlike classes, structs are value types and do not require heap allocation. A variable of a struct type directly contains the data of the struct, whereas a variable of a class type contains a reference to the data. They are derived from System.ValueType class.

Enum->An enum type is a distinct type that declares a set of named constants.They are strongly typed constants. They are unique types that allow to declare symbolic names to integral values. Enums are value types, which means they contain their own value, can't inherit or be inherited from and assignment copies the value of one enum to another.

public enum Grade
{
A,
B,
C
}


7• How do you create shared assemblies?

Just look through the definition of Assemblies.

  1. * An Assembly is a logical unit of code
  2. * Assembly physically exist as DLLs or EXEs
  3. * One assembly can contain one or more files
  4. * The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
  5. * When you compile your source code by default the exe/dll generated is actually an assembly
  6. * Unless your code is bundled as assembly it can not be used in any other application
  7. * When you talk about version of a component you are actually talking about version of the assembly to which the component belongs.
  8. * Every assembly file contains information about itself. This information is called as Assembly Manifest.
  9. Following steps are involved in creating shared assemblies :
  10. * Create your DLL/EXE source code
  11. * Generate unique assembly name using SN utility
  12. * Sign your DLL/EXE with the private key by modifying AssemblyInfo file
  13. * Compile your DLL/EXE
  14. * Place the resultant DLL/EXE in global assembly cache using AL utility

8• What is global assembly cache?

Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.

There are several ways to deploy an assembly into the global assembly cache:

1. Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
2. Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.
3. Use Windows Explorer to drag assemblies into the cache.

9• What is MSIL?

When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.

Before code can be run, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture.

When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type's members, the members that your code references, and other data that the runtime uses at execution time.

The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and common object file format (COFF) used historically for executable content. This file format, which accommodates MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during execution.

10• What is Jit compilers?.how many are available in clr?

Just-In-Time compiler- it converts the language that you write in .Net into machine language that a computer can understand. there are tqo types of JITs one is memory optimized & other is performace optimized.

RELATED POST

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART ONE

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART TWO

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART THREE

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART FOUR

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART FIVE

ADO.NET INTERVIEW QUESTIONS AND ANSWERS PART ONE

ADO.NET INTERVIEW QUESTIONS AND ANSWERS PART TWO

You can also learn the concept of frame work concept in detail with questions and answers in the following place.

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART ONE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART TWO

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART THREE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART FOUR

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART FIVE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART SIX

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART SEVEN

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART EIGHT

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART NINE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART TEN

No comments:

Post a Comment