Microsoft .NET Framework interview questions



# What are the contents of assembly?
In general, a static assembly can consist of four elements:

* The assembly manifest, which contains assembly metadata.
* Type metadata.
* Microsoft intermediate language (MSIL) code that implements the types.
* A set of resources.

# Difference between assembly manifest & metadata assembly manifest -
An integral part of every assembly that renders the assembly self-describing. The assembly manifest contains the assembly’s metadata. The manifest establishes the assembly identity, specifies the files that make up the assembly implementation, specifies the types and resources that make up the assembly, itemizes the compile-time dependencies on other assemblies, and specifies the set of permissions required for the assembly to run properly. This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible. metadata -Information that describes every element managed by the common language runtime: an assembly, loadable file, type, method, and so on. This can include information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and other information required by the runtime.

# What is Global Assembly Cache (GAC) and what is the purpose of it? (How to make an assembly to public? Steps)
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.  You should share assemblies by installing them into the global assembly cache only when you need to.

# If I have more than one version of one assemblies, then how’ll I use old version (how/where to specify version number?)in my application?

# How to find methods of a assembly file (not using ILDASM) Reflection

# Value type & data types difference. Example from .NET.

# Integer & struct are value types or reference types in .NET?

# What is Garbage Collection in .Net? Garbage collection process?
The process of transitively tracing through all pointers to actively used objects in order to locate all objects that can be referenced, and then arranging to reuse any heap memory that was not found during this trace. The common language runtime garbage collector also compacts the memory that is in use to reduce the working space needed for the heap.

# Readonly vs. const?
Aconstfield can only be initialized at the declaration of the field. Areadonlyfield can be initialized either at the declaration or in a constructor. Therefore,readonlyfields can have different values depending on the constructor used. Also, while aconstfield is a compile-time constant, thereadonlyfield can be used for runtime constants, as in the following example: public static readonly uint l1 = (uint) DateTime.Now.Ticks;

# < A: The primary steps to properly design custom attribute classes are as follows:

1.
2.
3.
4.

//Declaring properties
public bool MyProperty
{
get {return this.myvalue;}
set {this.myvalue = value;}
}

ion to get access to custom attributes.
class MainClass
{
public static void Main()
{
System.Reflection.MemberInfo info = typeof(MyClass);
object[] attributes = info.GetCustomAttributes();
for (int i = 0; i < attributes.Length; i ++)
{
System.Console.WriteLine(attributes[i]);
}
}
}

# C++ & C# differences

# What is the managed and unmanaged code in .net?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime’s functionality and enable you to write code that benefits from this managed execution environment. Code that you develop witha language compiler that targets the runtime is calledmanaged code; itbenefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.

# How do you create threading in .NET? What is the namespace for that?

# using directive vs using statement You create an instance in ausingstatement to ensure thatDispose is called on the object when the using statement is exited. Ausing statement can be exited either when the end of theusingstatement is reached or if, for example, an exception is thrown and control leaves the statement block before the end of the statement. The using directive has two uses.

* Create an alias for a namespace (a using alias).
* Permit the use of types in a namespace, such that, you do not have to qualify the use of a type in that namespace (ausingdirective).

# Describe the Managed Execution Process

# What is Active Directory? What is the namespace used to access the Microsoft Active Directories?

# Interop Services?

# What is RCW (Run time Callable Wrappers)?
The common language runtime exposes COM objects through a proxy called the runtime callable wrapper (RCW). Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.

# What is CCW (COM Callable Wrapper)

# A proxy object generated by the common language runtime so that existing COM applications can use managed classes, including .NET
Framework classes, transparently. How does you handle this COM components developed in other programming languages in .NET?

# How will you register com+ services?

# What is use of ContextUtil class?
ContextUtil is the preferred class to use for obtaining COM+ context information.

# What is the new three features of COM+ services, which are not there in COM (MTS)

# Is the COM architecture same as .Net architecture?  What is the difference between them (if at all there is)?



Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment: