Tuesday, July 1, 2008

.NET Interview Faq

.NET Framework - FAQ

When was .NET announced?
Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET.

When was the first version of .NET released?
The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.

What platforms does the .NET Framework run on?
The runtime supports Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms - for example, ASP.NET is only supported on Windows XP and Windows 2000. Windows 98/ME cannot be used for development.

IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home.
The Mono project is attempting to implement the .NET framework on Linux.

What is the CLR?
CLR = Common Language Runtime. The CLR is a set of standard resources that (in theory) any .NET program can take advantage of, regardless of programming language. Robert Schmidt (Microsoft) lists the following CLR resources in his MSDN PDC# article:

Object-oriented programming model (inheritance, polymorphism, exception handling, garbage collection)
 Security model
 Type system
 All .NET base classes
 Many .NET framework classes
 Development, debugging, and profiling tools
 Execution and code management
 IL-to-native translators and optimizers

What this means is that in the .NET world, different programming languages will be more equal in capability than they have ever been before, although clearly not all languages will support all CLR services.

What is the CTS?
CTS = Common Type System. This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS.

What is the CLS?
CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program, which uses CLS-compliant types, can interoperate with any .NET program written in any language.
In theory this allows very tight interop between different .NET languages - for example allowing a C# class to inherit from a VB class.

What is IL?
IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

What does 'managed' mean in the .NET context?
The term 'managed' is the cause of much confusion. It is used in various places within .NET, meaning slightly different things.Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).

Managed data: This is data that is allocated and de-allocated by the .NET runtime's garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword.Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages - for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.

What is reflection?
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.

Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes - e.g. determining data type sizes for marshaling data across context/process/machine boundaries.
Reflection can also be used to dynamically invoke methods (see System.Type.InvokeMember ) ,  or even create types dynamically at run-time (see System.Reflection.Emit.TypeBuilder).

What is the difference between Finalize and Dispose (Garbage collection) ?
Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object. In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object.

Dispose can be called even if other references to the object are alive. Note that even when you provide explicit control by way of Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from permanently leaking if the programmer fails to call Dispose.

What is Partial Assembly References?
Full Assembly reference: A full assembly reference includes the assembly's text name, version, culture, and public key token (if the assembly has a strong name). A full assembly reference is required if you reference any assembly that is part of the common language runtime or any assembly located in the global assembly cache.

Partial Assembly reference: We can dynamically reference an assembly by providing only partial information, such as specifying only the assembly name. When you specify a partial assembly reference, the runtime looks for the assembly only in the application
directory.

We can make partial references to an assembly in your code one of the following ways:

-> Use a method such as System.Reflection.Assembly.Load and specify only a partial reference. The runtime checks for the assembly in the application directory.

-> Use the System.Reflection.Assembly.LoadWithPartialName method and specify only a partial reference. The runtime checks for the assembly in the application directory and in the global assembly cache

Changes to which portion of version number indicates an incompatible change?
Major or minor. Changes to the major or minor portion of the version number indicate an incompatible change. Under this convention then, version 2.0.0.0 would be considered incompatible with version 1.0.0.0. Examples of an incompatible change would be a change to the types of some method parameters or the removal of a type or method altogether. Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases. Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a particular bug. You'll sometimes hear this referred to as the "emergency bug fix" number in that the revision is what is often changed when a fix to a specific bug is shipped to a customer.

What is side-by-side execution? Can two application one using private assembly and other using Shared assembly be stated as a side-by-side executables?
Side-by-side execution is the ability to run multiple versions of an application or component on the same computer. You can have multiple versions of the common language runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Since versioning is only applied to shared assemblies, and not to private assemblies, two application one using private assembly and one using shared assembly cannot be stated as side-by-side executables.

Why string are called Immutable data Type ?
The memory representation of string is an Array of Characters, So on re-assigning the new array of Char is formed & the start address is changed . Thus keeping the Old string in Memory for Garbage Collector to be disposed.

What does assert() method do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

What's the difference between the Debug class and Trace class?
Documentation looks the same.  Use Debug class for debug builds, use Trace class for both debug and release builds.

Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose.  For applications that are constantly running you run the risk of overloading the machine and the hard drive.  Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.

Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.

How do assemblies find each other?
By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache.

How does assembly versioning work?
Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly.The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline - it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file.

What is garbage collection?
Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time.

Why doesn't the .NET runtime offer deterministic destruction?
Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next sweep of the heap.

Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep.

Is the lack of deterministic destruction in .NET a problem?
It's certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects - in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management mechanism is needed to handle distributed objects - unfortunately the runtime offers no help with this.

What is serialization?
Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization / Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).

Does the .NET Framework have in-built support for serialization?
There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.

Can I customise the serialization process?
Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement] attribute, which can be used to specify the XML element name to be used for a particular property or field.

Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer's [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized.

Why is XmlSerializer so slow?
There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize or deserialize an object of a given type in an application, there is a significant delay. This normally doesn't matter, but it may mean, for example, that XmlSerializer is a poor choice for loading configuration settings during startup of a GUI application.

Why do I get errors when I try to serialize a Hashtable?
XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.

What are attributes?
There are at least two types of .NET attribute. The first type I will refer to as a metadata attribute - it allows some data to be attached to a class or method. This data becomes part of the metadata for the class, and (like other class metadata) can be accessed via reflection.
The other type of attribute is a context attribute. Context attributes use a similar syntax to metadata attributes but they are fundamentally different. Context attributes provide an interception mechanism whereby instance activation and method calls can be pre- and/or post-processed.

How does CAS work?
The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set.
For example, using the default security policy, a control downloaded from a web site belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.)

Who defines the CAS code groups?
Microsoft defines some default ones, but you can modify these and even create your own. To see the code groups defined on your system, run 'caspol -lg' from the command-line. On my system it looks like this:

Level = Machine
Code Groups:
1.  All code: Nothing
   1.1.  Zone - MyComputer: FullTrust
      1.1.1.  Honor SkipVerification requests: SkipVerification
   1.2.  Zone - Intranet: LocalIntranet
   1.3.  Zone - Internet: Internet
   1.4.  Zone - Untrusted: Nothing
   1.5.  Zone - Trusted: Internet
   1.6.  StrongName - 0024000004800000940000000602000000240000525341310004000003
000000CFCB3291AA715FE99D40D49040336F9056D7886FED46775BC7BB5430BA4444FEF8348EBD06
F962F39776AE4DC3B7B04A7FE6F49F25F740423EBF2C0B89698D8D08AC48D69CED0FC8F83B465E08
07AC11EC1DCC7D054E807A43336DDE408A5393A48556123272CEEEE72F1660B71927D38561AABF5C
AC1DF1734633C602F8F2D5:

Note the hierarchy of code groups - the top of the hierarchy is the most general ('All code'), which is then sub-divided into several groups, each of which in turn can be sub-divided. Also note that (somewhat counter-intuitively) a sub-group can be associated with a more permissive permission set than its parent.

How do I define my own code group?
Use caspol. For example, suppose you trust code from www.mydomain.com and you want it have full access to your system, but you want to keep the default restrictions for all other internet sites. To achieve this, you would add a new code group as a sub-group of the  'Zone - Internet' group, like this:
caspol -ag 1.3 -site www.mydomain.com FullTrust
Now if you run caspol -lg you will see that the new group has been added as group 1.3.1:

   1.3.  Zone - Internet: Internet
      1.3.1.  Site - www.mydomain.com: FullTrust

Note that the numeric label (1.3.1) is just a caspol invention to make the code groups easy to manipulate from the command-line. The underlying runtime never sees it.

How do I change the permission set for a code group?
Use caspol. If you are the machine administrator, you can operate at the 'machine' level - which means not only that the changes you make become the default for the machine, but also that users cannot change the permissions to be more permissive. If you are a normal (non-admin) user you can still modify the permissions, but only to make them more restrictive. For example, to allow intranet code to do what it likes you might do this:

caspol -cg 1.2 FullTrust

Note that because this is more permissive than the default policy (on a standard system), you should only do this at the machine level - doing it at the user level will have no effect.

I can't be bothered with all this CAS stuff. Can I turn it off?
Yes, as long as you are an administrator. Just run: caspol -s off

Can I look at the IL for an assembly?
Yes. MS supply a tool called Ildasm which can be used to view the metadata and IL for an assembly.

Can source code be reverse-engineered from IL?
Yes, it is often relatively straightforward to regenerate high-level source (e.g. C#) from IL.

How can I stop my code being reverse-engineered from IL?
There is currently no simple way to stop code being reverse-engineered from IL. In future it is likely that IL obfuscation tools will become available, either from MS or from third parties. These tools work by 'optimising' the IL in such a way that reverse-engineering becomes much more difficult.

Of course if you are writing web services then reverse-engineering is not a problem as clients do not have access to your IL.

Is there built-in support for tracing/logging?
Yes, in the System.Diagnostics namespace. There are two main classes that deal with tracing - Debug and Trace. They both work in a similar way - the difference is that tracing from the Debug class only works in builds that have the DEBUG symbol defined, whereas tracing from the Trace class only works in builds that have the TRACE symbol defined. Typically this means that you should use System.Diagnostics.Trace.WriteLine for tracing that you want to work in debug and release builds, and System.Diagnostics.Debug.WriteLine for tracing that you want to work only in debug builds.

Can I redirect tracing to a file?
Yes. The Debug and Trace classes both have a Listeners property, which is a collection of sinks that receive the tracing that you send via Debug.WriteLine and Trace.WriteLine respectively. By default the Listeners collection contains a single sink, which is an instance of the DefaultTraceListener class. This sends output to the Win32 OutputDebugString() function and also the System.Diagnostics.Debugger.Log() method. This is useful when debugging, but if you're trying to trace a problem at a customer site, redirecting the output to a file is more appropriate. Fortunately, the TextWriterTraceListener class is provided for this purpose.

What are the contents of assembly?
In general, a static assembly can consist of four elements:
i)   The assembly manifest, which contains assembly metadata.
ii)  Type metadata.
iii) Microsoft intermediate language (MSIL) code that implements the types.
iv)  A set of resources.

What is GC (Garbage Collection) and how it works
One of the good features of the CLR is Garbage Collection, which runs in the background collecting unused object references, freeing us from having to ensure we always destroy them. In reality the time difference between you releasing the object instance and it being garbage collected is likely to be very small, since the GC is always running.
[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.]

Heap:
A portion of memory reserved for a program to use for the temporary storage of data structures whose existence or size cannot be determined until the program is running.

Differnce between Managed code and unmanaged code ?
Managed Code:
Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for the runtime to provide services such as memory management, cross-language integration, code access security, and
automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.

Un-Managed Code:
Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging, and so on).

What is MSIL, IL, CTS and, CLR ?
MSIL: (Microsoft intermediate language)
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 executed, 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 executed 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.

IL: (Intermediate Language)
A language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.

CTS: (Common Type System)
The specification that determines how the common language runtime defines, uses, and manages types

CLR: (Common Language Runtime)
The engine at the core of managed code execution. The runtime supplies managed code with services such as cross-language integration, code access security, object lifetime management, and debugging and profiling support.

What is Reference type and value type ?
Reference Type:
Reference types are allocated on the managed CLR heap, just like object types.
A data type that is stored as a reference to the value's location. The value of a reference type is the location of the sequence of bits that represent the type's data. Reference types can be self-describing types, pointer types, or interface types

Value Type:
Value types are allocated on the stack just like primitive types in VBScript, VB6 and C/C++. Value types are not instantiated using new go out of scope when the function they are defined within returns.
Value types in the CLR are defined as types that derive from system.valueType.

A data type that fully describes a value by specifying the sequence of bits that constitutes the value's representation. Type information for a value type instance is not stored with the instance at run time, but it is available in metadata. Value type instances can be treated as objects using boxing.

What is Boxing and unboxing ?
Boxing:
The conversion of a value type instance to an object, which implies that the instance will carry full type information at run time and will be allocated in the heap. The Microsoft intermediate language (MSIL) instruction set's box instruction converts a value type to an object by making a copy of the value type and embedding it in a newly allocated object.

Un-Boxing:
The conversion of an object instance to a value type.

What is JIT and how is works ?
An acronym for "just-in-time," a phrase that describes an action that is taken only when it becomes necessary, such as just-in-time compilation or just-in-time object activation

What is portable executable (PE) ?
The file format used for executable programs and for files to be linked together to form executable programs

What is strong name?
A name that consists of an assembly's identity—its simple text name, version number, and culture information (if provided)—strengthened by a public key and a digital signature generated over the assembly. Because the assembly manifest contains file hashes for all the files that constitute the assembly implementation, it is sufficient to generate the digital signature over just the one file in the assembly that contains the assembly manifest. Assemblies with the same strong name are expected to be identical

What is global assembly cache?
A machine-wide code cache that stores assemblies specifically installed to be shared by many applications on the computer. Applications deployed in the global assembly cache must have a strong name.

What is difference between constants, readonly and, static ?
Constants: The value can’t be changed
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.

What is difference between shared and public?
An assembly that can be referenced by more than one application. An assembly must be explicitly built to be shared by giving it a cryptographically strong name.

What is namespace used for loading assemblies at run time and name the methods?
System.Reflection

What are the types of authentication in .net?
We have three types of authentication:
1. Form authentication
2. Windows authentication
3. Passport
This has to be declared in web.config file.

What is the difference between a Struct and a Class ?
The struct type is suitable for representing lightweight objects such as Point, Rectangle, and Color. Although it is possible to represent a point as a class, a struct is more efficient in some scenarios. For example, if you declare an array of 1000 Point objects,you will allocate additional memory for referencing each object. In this case, the struct is less expensive.

When you create a struct object using the new operator, it gets created and the appropriate constructor is called. Unlike classes, structs can be instantiated without using the new operator. If you do not use new, the fields will remain unassigned and the object cannot be used until all of the fields are initialized. It is an error to declare a default (parameterless) constructor for a struct. A default constructor is always provided to initialize the struct members to their default values.
It is an error to initialize an instance field in a struct.
There is no inheritance for structs as there is for classes. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Structs, however, inherit from the base class Object. A struct can implement interfaces, and it does that exactly as classes do.
A struct is a value type, while a class is a reference type.

How big is the datatype int in .NET?
32 bits.

How big is the char?
16 bits (Unicode).

How do you initiate a string without escaping each backslash?
Put an @ sign in front of the double-quoted string.

What's the access level of the visibility type internal?
Current application.

Explain encapsulation?
The implementation is hidden, the interface is exposed.

What data type should you use if you want an 8-bit value that's signed?
sbyte.

Speaking of Boolean data types, what's different between C# and C/C++?
There's no conversion between 0 and false, as well as any other number and true, like in C/C++.

Where are the value-type variables allocated in the computer RAM?
Stack.

Where do the reference-type variables go in the RAM?
The references go on the stack, while the objects themselves go on the heap.

What is the difference between the value-type variables and reference-type variables in terms of garbage collection?
The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, GC picks up the reference-type objects when their references go null.

How do you convert a string into an integer in .NET?
Int32.Parse(string)

How do you box a primitive data type variable?
Assign it to the object, pass an object.

Why do you need to box a primitive variable?
Pass it by reference.

What's the difference between Java and .NET garbage collectors?
Sun left the implementation of a specific garbage collector up to the JRE developer, so their performance varies widely, depending on whose JRE you're using. Microsoft standardized on their garbage collection.

How do you enforce garbage collection in .NET?
System.GC.Collect();

What's different about namespace declaration when comparing that to package declaration in Java?
No semicolon.

What's the difference between const and readonly?
You can initialize readonly variables to some runtime values. Let's say your program uses current date and time as one of the values that won't change. This way you declare public readonly string DateT = new DateTime().ToString().

What happens when you encounter a continue statement inside the for loop?
The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop.

What's the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it's being operated on, a new instance is created.

Can you store multiple data types in System.Array?
No.

What's the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one performs a shallow copy.

How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.

What's the .NET datatype that allows the retrieval of data by a unique key?
HashTable.

What's class SortedList underneath?
A sorted Hash Table.

Will finally block get executed if the exception had not occurred?
Yes.

Can multiple catch blocks be executed?
No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.

Why is it a bad idea to throw your own exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block?
Throwing your own exceptions signifies some design flaws in the project.

What's a delegate?
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.

What's a multicast delegate?
It's a delegate that points to and eventually fires off several methods.

How's the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32),  but also the version of the assembly.

What are the ways to deploy an assembly?
 An MSI installer, a CAB archive, and XCOPY command.

What's a satellite assembly?
When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

What namespaces are necessary to create a localized application?
System.Globalization, System.Resources.

What does assert() do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

What's the difference between the Debug class and Trace class?
Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.

Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.

Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.

What are three test cases you should go through in unit testing?
Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception  test cases (exceptions are thrown and caught properly).

Can you change the value of a variable while debugging a C# application?
Yes, if you are debugging via Visual Studio.NET, just go to immediate window.

What's the implicit name of the parameter that gets passed into the class' set method?
Value, and it's datatype depends on whatever variable we're changing.

How do you inherit from a class in C#?
Place a colon and then the name of the base class. Notice that it's double colon in C++.

Does C# support multiple inheritance?
No, use interfaces instead.

When you inherit a protected class-level variable, who is it available to?
Derived Classes.

What's the top .NET class that everything is derived from?
System.Object.

How's method overriding different from overloading?
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the  same name within the class.

What does the keyword virtual mean in the method definition?
The method can be over-ridden.

Can you declare the override method static while the original method is non-static?
No, you can't, the signature of the virtual method must remain the same, and only the keyword virtual is changed to keyword override.

Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.

Can you prevent your class from being inherited and becoming a base class for some other classes?
Yes, that's what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It's the same concept as final class in Java.

Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.

Why can't you specify the accessibility modifier for methods inside the interface?
They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.

Can you inherit multiple interfaces? And if they have conflicting method names?
Yes, why not.

It's up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you're okay.

What's the difference between an interface and abstract class?
In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

How can you overload a method?
By having Different parameter data types.
By having different number of parameters.
By having different order of parameters.

If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

What's the difference between System.String and System.StringBuilder classes?
System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

Does C# support multiple-inheritance?
No, use interfaces instead.

When you inherit a protected class-level variable, who is it available to?
The derived class.

Are private class-level variables inherited?
Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited.

Describe the accessibility modifier "protected internal".
It is available to derived classes and classes within the same Assembly (and naturally from the base class it's declared in).

What's the top .NET class that everything is derived from?
System.Object.

What's the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time it's being operated on, a new instance is created.

Can you store multiple data types in System.Array?
No.

What's the .NET class that allows the retrieval of a data element using a unique key?
HashTable.

Will the finally block get executed if an exception has not occurred?
Yes.

What's an abstract class?
Abstract class is a class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.

When do you absolutely have to declare a class as abstract?
 1.       When at least one of the methods in the class is abstract.
 2.       When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.

What's an interface?
It's an abstract class with public abstract methods all of which must be implemented in the inherited classes.

Why can't you specify the accessibility modifier for methods inside the interface?
They all must be public.  Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.

What's the difference between an interface and abstract class?
In an interface class, all methods must be abstract.  In an abstract class some methods can be concrete.  In an interface class, no accessibility modifiers are allowed, which is ok in an abstract class.

How is method overriding different from method overloading?
When overriding a method, you change the behavior of the method for the derived class.  Overloading a method simply involves having another method with the same name within the class.

Can you declare an override method to be static if the original method is non-static?
No. The signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.

Can you override private virtual methods?
No.  Private methods are not accessible outside the class.

Can you write a class without specifying namespace? Which namespace does it belong to by default?
Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you  wouldn't want global namespace.

What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.

Different b/w .NET & J2EE?

Differences between J2EE and the .NET Platform
Vendor Neutrality
The .NET platform is not vendor neutral, it is tied to the Microsoft operating systems. But neither are any of the J2EE implementations
Many companies buy into J2EE believing that it will give them vendor neutrality. And, in fact, this is a stated goal of Sun's vision:
A wide variety of J2EE product configurations and implementations, all of which meet the requirements of this specification, are possible. A portable J2EE application will function correctly when successfully deployed in any of these products. (ref : Java 2 Platform Enterprise Edition Specification, v1.3, page 2-7 available at http://java.sun.com/j2ee/)

Overall Maturity
Given that the .NET platform has a three year lead over J2EE, it should be no surprise to learn that the .NET platform is far more mature than the J2EE platform. Whereas we have high volume highly reliable web sites using .NET technologies (NASDAQ and Dell being among many examples)

Interoperability and Web Services
The .NET platform eCollaboration model is, as I have discussed at length, based on the UDDI and SOAP standards. These standards are widely supported by more than 100 companies. Microsoft, along with IBM and Ariba, are the leaders in this area. Sun is a member of the UDDI consortium and recognizes the importance of the UDDI standards. In a recent press release, Sun's George Paolini, Vice President for the Java Community Development, says: "Sun has always worked to help establish and support open, standards-based technologies that facilitate the growth of network-based applications, and we see UDDI as an important project to establish a registry framework for business-to-business e-commerce”. But while Sun publicly says it believes in the UDDI standards, in reality, Sun has done nothing whatsoever to incorporate any of the UDDI standards into J2EE.

Scalability
Typical Comparision w.r.t Systems and their costs

J2EE

Company System   Total Sys.                                             Cost
Bull             Escala T610 c/s                                  16,785  $1,980,179    
IBM              RS/6000 Enterprise Server F80                   16,785  $2,026,681    
Bull             Escala EPC810 c/s                                33,375  $3,037,499    
IBM              RS/6000 Enterprise Server M80                   33,375  $3,097,055    
Bull             Escala EPC2450                                   110,403 $9,563,263    
IBM              IBM eServer pSeries 680 Model 7017-S85   110,403 $9,560,594    

.NET platform systems

Company System     Total Sys.                                     Cost
Dell              PowerEdge 4400                            16,263  $273,487      
Compaq             ProLiant ML-570-6/700-3P               20,207  $201,717   
  
Dell               PowerEdge 6400                            30,231  $334,626      
IBM                Netfinity 7600 c/s                        32,377  $443,463      
Compaq            ProLiant 8500-X550-64P                  161,720 $3,534,272
   
Compaq               ProLiant 8500-X700-64P                    179,658 $3,546,582    
Compaq               ProLiant 8500-X550-96P                    229,914 $5,305,571    
Compaq               ProLiant 8500-X700-96P                    262,244 $5,305,571    
Compaq               ProLiant 8500-700-192P                    505,303 $10,003,826   

Framework Support
The .NET platform includes such an eCommerce framework called Commerce Server. At this point, there is no equivalent vendor-neutral framework in the J2EE space. With J2EE, you should assume that you will be building your new eCommerce solution from scratch
Moreover, no matter what [J2EE] vendor you choose, if you expect a component framework that will allow you to quickly field complete e-business applications, you are in for a frustrating experience

Language
In the language arena, the choice is about as simple as it gets. J2EE supports Java, and only Java. It will not support any other language in the foreseeable future. The .NET platform supports every language except Java (although it does support a language that is syntactically and functionally equivalent to Java, C#). In fact, given the importance of the .NET platform as a language independent vehicle, it is likely that any language that comes out in the near future will include support for the .NET platform.
Some companies are under the impression that J2EE supports other languages. Although both IBM's WebSphere and BEA's WebLogic support other languages, neither does it through their J2EE technology. There are only two official ways in the J2EE platform to access other languages, one through the Java Native Interface and the other through CORBA interoperability. Sun recommends the later approach. As Sun's Distinguished Scientist and Java Architect Rick Cattell said in a recent interview.

Portability
The reason that operating system portability is a possibility with J2EE is not so much because of any inherent portability of J2EE, as it is that most of the J2EE vendors support multiple operating systems. Therefore as long as one sticks with a given J2EE vendor and a given database vendor, moving from one operating system to another should be possible. This is probably the single most important benefit in favor of J2EE over the .NET platform, which is limited to the Windows operating system. It is worth noting, however, that Microsoft has submitted the specifications for C# and a subset of the .NET Framework (called the common language infrastructure) to ECMA, the group that standardizes JavaScript.
J2EE offers an acceptable solution to ISVs when the product must be marketed to non-Windows customers, particularly when the J2EE platform itself can be bundled with the ISV's product as an integrated offering.
If the primary customer base for the ISV is Windows customers, then  the .NET platform should be chosen.  It will provide much better performance at a much lower cost.

Client device independence
The major difference being that with Java, it is the presentation tier programmer that determines the ultimate HTML that will be delivered to the client, and with .NET, it is a Visual Studio.NET control.
This Java approach has three problems. First, it requires a lot of code on the presentation tier, since every possible thin client system requires a different code path. Second, it is very difficult to test the code with every possible thin client system. Third, it is very difficult to add new thin clients to an existing application, since to do so involves searching through, and modifying a tremendous amount of presentation tier logic.
The .NET Framework approach is to write device independent code that interacts with visual controls. It is the control, not the programmer, that is responsible for determining what HTML to deliver, based on the capabilities of the client device.. In the .NET Framework model, one can forget that such a thing as HTML even exists!
Conclusion
Sun's J2EE vision is based on a family of specifications that can be implemented by many vendors. It is open in the sense that any company can license and implement the technology, but closed in the sense that it is controlled by a single vendor, and a self contained architectural island with very limited ability to interact outside of itself. One of J2EE's major disadvantages is that the choice of the platform dictates the use of a single programming language, and a programming language that is not well suited for most businesses. One of J2EE's major advantages is that most of the J2EE vendors do offer operating system portability.
Microsoft's .NET platform vision is a family of products rather than specifications, with specifications used primarily to define points of interoperability. The major disadvantage of this approach is that if is limited to the Windows platform, so applications written for the .NET platform can only be run on .NET platforms. Their are several important advantages to the .NET platform:
* The cost of developing applications is much lower, since standard business languages can be used and device independent presentation tier logic can be written.
* The cost of running applications is much lower, since commodity hardware platforms (at 1/5 the cost of their Unix counterparts) can be used.
* The ability to scale up is much greater, with the proved ability to support at least ten times the number of clients any J2EE platform has shown itself able to support.
* Interoperability is much stronger, with industry standard eCollaboration built into the platform.

What are the Main Features of .NET platform?

Features of .NET Platform are :-
Common Language Runtime
Explains the features and benefits of the common language runtime, a run-time environment that manages the execution of code and provides services that simplify the development process.

Assemblies
Defines the concept of assemblies, which are collections of types and resources that form logical units of functionality. Assemblies are the fundamental units of deployment, version control, reuse, activation scoping, and security permissions.

Application Domains
Explains how to use application domains to provide isolation between applications.

Runtime Hosts
Describes the runtime hosts supported by the .NET Framework, including ASP.NET, Internet Explorer, and shell executables.

Common Type System
Identifies the types supported by the common language runtime.

Metadata and Self-Describing Components
Explains how the .NET Framework simplifies component interoperation by allowing compilers to emit additional declarative information, or metadata, into all modules and assemblies.

Cross-Language Interoperability
Explains how managed objects created in different programming languages can interact with one another.

.NET Framework Security
Describes mechanisms for protecting resources and code from unauthorized code and unauthorized users.

.NET Framework Class Library
Introduces the library of types provided by the .NET Framework, which expedites and optimizes the development process and gives you access to system functionality.

What is the use of JIT ?
JIT (Just - In - Time) is a compiler which converts MSIL code to Native Code (ie.. CPU-specific code that runs on the same computer architecture).
Because the common language runtime supplies a JIT compiler for each supported CPU architecture, developers can write a set of MSIL that can be JIT-compiled and run on computers with different architectures. However, your managed code will run only on a specific operating system if it calls platform-specific native APIs, or a platform-specific class library.
JIT compilation takes into account the fact that some code might never get called during execution. Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as needed during execution and stores the resulting native code so that it is accessible for subsequent calls. The loader creates and attaches a stub to each of a type's methods when the type is loaded. On the initial call to the method, the stub passes control to the JIT compiler, which converts the MSIL for that method into native code and modifies the stub to direct execution to the location of the native code. Subsequent calls of the JIT-compiled method proceed directly to the native code that was previously generated, reducing the time it takes to JIT-compile and run the code.

What meant of assembly & global assembly cache (gac) & Meta data.
Assembly :-- An assembly is the primary building block of a .NET based application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit. It overcomes the problem of 'dll Hell'.The .NET Framework uses assemblies as the fundamental unit for several purposes:
1.Security 
2.Type Identity 
3.Reference Scope 
4.Versioning 
5.Deployment

Global Assembly Cache :-- Assemblies can be shared among multiple applications on the machine by registering them in global Assembly cache(GAC). GAC is a machine wide a local cache of assemblies maintained by the .NET Framework. We can register the assembly to global assembly cache by using gacutil command.

We can Navigate to the GAC directory, C:\winnt\Assembly in explore. In the tools menu select the cache properties; in the windows displayed you can set the memory limit in MB used by the GAC

MetaData :--Assemblies have Manifests. This Manifest contains Metadata information of the Module/Assembly as well as it contains detailed Metadata of other assemblies/modules references (exported). It's the Assembly Manifest which differentiates between an Assembly and a Module.

What are the mobile devices supported by .net platform
The Microsoft .NET Compact Framework is designed to run on mobile devices such as mobile phones, Personal Digital Assistants (PDAs), and embedded devices. The easiest way to develop and test a Smart Device Application is to use an emulator.

These devices are divided into two main divisions:
1) Those that are directly supported by .NET (Pocket PCs, i-Mode phones, and WAP devices)
2) Those that are not (Palm OS and J2ME-powered devices).

What is GUID , why we use it and where?
GUID :-- GUID is Short form of Globally Unique Identifier, a unique 128-bit number that is produced by the Windows OS or by some Windows applications to identify a particular component, application, file, database entry, and/or user. For instance, a Web site may generate a GUID and assign it to a user's browser to record and track the session. A GUID is also used in a Windows registry to identify COM DLLs. Knowing where to look in the registry and having the correct GUID yields a lot information about a COM object (i.e., information in the type library, its physical location, etc.). Windows also identifies user accounts by a username (computer/domain and username) and assigns it a GUID. Some database administrators even will use GUIDs as primary key values in databases.
GUIDs can be created in a number of ways, but usually they are a combination of a few unique settings based on specific point in time (e.g., an IP address, network MAC address, clock date/time, etc.).

Describe the difference between inline and code behind - which is best in a loosely coupled solution
ASP.NET supports two modes of page development: Page logic code that is written inside runat="server"> blocks within an .aspx file and dynamically compiled the first time the page is requested on the server. Page logic code that is written within an external class that is compiled prior to deployment on a server and linked ""behind"" the .aspx file at run time.

Whats MSIL, and why should my developers need an appreciation of it if at all?
When compiling the source code to managed code, the compiler translates the source into Microsoft intermediate language (MSIL). This is a CPU-independent set of instructions that can efficiently be converted to native code. Microsoft intermediate language (MSIL) is a translation used as the output of a number of compilers. It is the input to a just-in-time (JIT) compiler. The Common Language Runtime includes a JIT compiler for the conversion of MSIL to native code.

Before Microsoft Intermediate Language (MSIL) can be executed it, must be converted by the .NET Framework just-in-time (JIT) compiler to native code. This is CPU-specific code that runs on the same computer architecture as the JIT compiler. Rather than using time and memory to convert all of the MSIL in a portable executable (PE) file to native code. It converts the MSIL as needed whilst executing, then caches the resulting native code so its accessible for any subsequent calls.

How many .NET languages can a single .NET DLL contain?
One

What type of code (server or client) is found in a Code-Behind class?
Server

What is an assembly?
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.

How many classes can a single .NET DLL contain?
Unlimited.

What is the difference between string and String ?
No difference

What is manifest?
It is the metadata that describes the assemblies.

What is metadata?
Metadata is machine-readable information about a resource, or ""data about data."" Such information might include details on content, format, size, or other characteristics of a datasource. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information.

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;

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.

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.

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.

What Is Boxing And Unboxing?
Boxing :- Boxing is an implicit conversion of a value type to the type object type
Eg:-
Consider the following declaration of a value-type variable:
int i = 123;
object o = (object) i;
Boxing Conversion
UnBoxing :- Unboxing is an explicit conversion from the type object to a value type
Eg:
int i = 123;          // A value type
object box = i;       // Boxing
int j = (int)box;     // Unboxing

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

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
}

What is namespaces?
Namespace is a logical naming scheme for group related types.Some class types that logically belong together they can be put into a common namespace. They prevent namespace collisions and they provide scoping. They are imported as "using" in C# or "Imports" in Visual Basic. It seems as if these directives specify a particular assembly, but they don't. A namespace can span multiple assemblies, and an assembly can define multiple namespaces. When the compiler needs the definition for a class type, it tracks  through each of the different imported namespaces to the type name and searches each referenced assembly until it is found.
Namespaces can be nested. This is very similar to packages in Java as far as scoping is concerned.

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

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.  

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.

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.

What is tracing?Where it used. Explain few methods available
Tracing refers to collecting information about the application while it is running. You use tracing  information to troubleshoot an application.
Tracing allows us to observe and correct programming errors. Tracing enables you to record information in various log files about the errors that might occur at run time. You can analyze these log files to find the cause of the errors.
In .NET we have objects called Trace Listeners. A listener is an object that receives the trace output and outputs it somewhere; that somewhere could be a window in your development environment, a file on your hard drive, a Windows Event log, a SQL Server or Oracle database, or any other customized data store.
The System.Diagnostics namespace provides the interfaces, classes, enumerations and structures that are used for tracing The System.Diagnostics namespace provides two classes named Trace and Debug that are used for writing errors and application execution information in logs.
All Trace Listeners have the following functions. Functionality of these functions is same except that the target media for the tracing output is determined by the Trace Listener.
Method Name
Result Fail   Outputs the specified text with the Call Stack.
Write   Outputs the specified text.
WriteLine     Outputs the specified text and a carriage return.
Flush   Flushes the output buffer to the target media.
Close   Closes the output stream in order to not receive the tracing/debugging output.

How to set the debug mode?
Debug Mode for ASP.NET applications - To set ASP.NET appplication in debugging mode, edit the application's web.config and assign the "debug" attribute in < compilation > section to "true" as show below:
< configuration >
  < system.web >
    < compilation defaultLanguage="vb" debug="true" / >
....
...
..
< / configuration >
This case-sensitive attribute 'debug tells ASP.NET to generate symbols for dynamically generated files and enables the debugger to attach to the ASP.NET application. ASP.NET will detect this change automatically, without the need to restart the server. Debug Mode for ASP.NET Webservices - Debugging an XML Web service created with ASP.NET is similar to the debugging an ASP.NET Web application.

What is the property available to check if the page posted or not?
The Page_Load event handler in the page checks for IsPostBack property value, to ascertain whether the page is posted. The Page.IsPostBack gets a value indicating whether the page is being loaded in response to the client postback, or it is for the first time. The value of Page.IsPostBack is True, if the page is being loaded in response to the client postback; while its value is False, when the page is loaded for the first time. The Page.IsPostBack property facilitates execution of certain routine in Page_Load, only once (for e.g. in Page load, we need to set default value in controls, when page is loaded for the first time. On post back, we check for true value for IsPostback value and then invoke server-side code to
update data).

Which are the abstract classes available under system.xml namespace?
The System.XML namespace provides XML related processing ability in .NET framework. XmlReader and XMLWriter are the two abstract classes at the core of .NET Framework XML classes:
1. XmlReader provides a fast, forward-only, read-only cursor for processing an XML document stream.
2. XmlWriter provides an interface for producing XML document streams that conform to the W3C's XML standards.
Both XmlReader and XmlWriter are abstract base classes, which define the functionality that all derived classes must support.

Is it possible to use multipe inheritance in .net?
Multiple Inheritance is an ability to inherit from more than one base class i.e.  ability of a class to have more than one superclass, by inheriting from different sources and thus combine separately-defined behaviors in a single class. There are two types of multiple inheritance: multiple type/interface inheritance and multiple implementation inheritance. C# & VB.NET supports only multiple type/interface inheritance, i.e.
you can derive an class/interface from multiple interfaces. There is no support for multiple implementation inheritance in .NET. That means a class can only derived from one class.

What are the derived classes from xmlReader and xmlWriter?
Both XmlReader and XmlWriter are abstract base classes, which define the functionality that all derived classes must support.
There are three concrete implementations of XmlReader:
       1.XmlTextReader
       2.XmlNodeReader
       3.XmlValidatingReader
There are two concrete implementations of XmlWriter:
       1.XmlTextWriter
       2.XmlNodeWriter
XmlTextReader and XmlTextWriter support reading data to/from text-based stream, while XmlNodeReader and XmlNodeWriter are designed for working with in-memory DOM tree structure. The custom readers and writers can also be developed to extend the built-in functionality of XmlReader and XmlWriter.

What is managed and unmanaged code?
The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. i.e., code executing under the control of the CLR is called managed code. For example, any code written in C# or Visual Basic .NET is managed code.
Code that runs outside the CLR is referred to as "unmanaged code." COM components, ActiveX components, and Win32 API functions are examples of unmanaged code.

How you deploy .NET assemblies?
One way is simply use xcopy. others are use and the setup projects in .net. and one more way is use of no touch deployment.

What is Globalizationa and Localization ?
Globalization is the process of creating an application that meets the needs of users from multiple cultures. It includes using the correct
currency, date and time format, calendar, writing direction, sorting rules, and other issues. Accommodating these cultural differences in an application is called localization.Using classes of System.Globalization namespace, you can set application's current culture.
This can be achieved by using any of the following 3 approaches.
      1.      Detect and redirect
      2.      Run-time adjustment
      3.      Using Satellite assemblies.

What are Resource Files ? How are they used in .NET?
Resource files are the files containing data that is logically deployed with an application.These files can contain data in a number of formats including strings, images and persisted objects. It has the main advantage of If we store data in these files then we don't need to compile these if the data get changed. In .NET we basically require them storing culture specific informations by localizing application's resources. You can deploy your resources using satellite assemblies.

Difference between Dispose and Finallize method?
Finalize method is used to free the memory used by some unmanaged resources like window handles (HWND). It's similar to the destructor syntax in C#. The GC calls this method when it founds no more references to the object. But, In some cases we may need release the memory used by the resources explicitely.To release the memory explicitly we need to implement the Dispose method of IDisposable interface.

What is encapsulation ?
Encapsulation is the ability to hide the internal workings of an object's behavior and its data. For instance, let's say you have a object named Bike and this object has a method named start(). When you create an instance of a Bike object and call its start() method you are not worried about what happens to accomplish this, you just want to make sure the state of the bike is changed to 'running' afterwards. This kind of behavior hiding is encapsulation and it makes programming much easier.

How can you prevent your class to be inherated further?
By setting Sealed - Key word
 public sealed class Planet
 {
             //code goes here
 }
class Moon:Planet
 {
     //Not allowed as base class is sealed
 }
What is GUID and why we need to use it and in what condition? How this is created.
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever  a unique identifier is required. Such an identifier has a very low probability of being duplicated. Visual Studio .NET IDE has a utility under the tools menu to generate GUIDs.

Why do you need to serialize.?
We need to serialize the object,if you want to pass object from one  computer/application domain to another.Process of converting complex objects into stream of bytes that can be persisted or  transported.Namespace for serialization is System.Runtime.Serialization.The  ISerializable interface allows you to make any class Serializable..NET framework features 2 serializing method.
1.Binary Serialization
2.XML Serialization

What is inline schema, how does it works?
Schemas can be included inside of XML file is called Inline Schemas.This is useful  when it is inconvenient to physically seprate the schema and the XML document.A  schema is an XML document that defines the structure, constraints, data types, and  relationships of the elements that constitute the data contained inside the XML  document or in another XML document.Schema can be an external file which uses the  XSD or XDR extension called external schema. Inline schema can take place even when validation is turned off.

Describe the advantages of writing a managed code application instead of unmanaged one. What's involved in certain piece of code being managed?
"Advantage includes automatic garbage collection,memory management,security,type checking,versioning

Managed code is compiled for the .NET run-time environment. It runs in the Common Language Runtime (CLR), which is the heart of the .NET Framework. The CLR provides services such as security, memory management, and cross-language integration. Managed applications written to take advantage of the features of the CLR perform more efficiently and safely, and take better advantage of developers existing expertise in languages that support the .NET Framework.

Unmanaged code includes all code written before the .NET Framework was introduced—this includes code written to use COM, native Win32, and Visual Basic 6. Because it does not run inside the .NET environment, unmanaged code cannot make use of any .NET managed facilities."

What are multicast delegates? Give an example?
Delegate that can have more than one element in its invocation List.
using System;
namespace SampleMultiCastDelegate
{
  class MultiCast
  {
    public delegate string strMultiCast(string s);
  }
}

MainClass defines the static methods having same signature as delegate.
using System;
namespace SampleMultiCastDelegate
{

  public class MainClass
  {
    public MainClass()
    {
    }
public static string Jump(string s)
{
Console.WriteLine("Jump");
     return String.Empty;
 }
    public static string Run(string s)
    {
      Console.WriteLine("Run");
      return String.Empty;
    }
    public static string Walk(string s)
    {
      Console.WriteLine("Walk");
      return String.Empty;     
    }
  }
}
The Main class:
using System;
using System.Threading;
namespace SampleMultiCastDelegate
{

  public class MainMultiCastDelegate
  {
    public static void Main()
    {
      MultiCast.strMultiCast  Run,Walk,Jump;
      MultiCast.strMultiCast    myDelegate;
       ///here mydelegate used the Combine method of System.MulticastDelegate
      ///and the delegates combine 
      myDelegate=(MultiCast.strMultiCast)System.Delegate.Combine(Run,Walk);
              
    }
  }
}

Can a nested object be used in Serialization ?
Yes. If a class that is to be serialized contains references to objects of other classes, and if those classes have been marked as serializable, then their objects are serialized too.

Difference between int and int32 ?
Both are same. System.Int32 is a .NET class. Int is an alias name for System.Int32.

Describe the difference between a Thread and a Process?
A Process is an instance of an running application. And a thread is the Execution stream of the Process. A process can have multiple Thread.
When a process starts a specific memory area is allocated to it. When there is multiple thread in a process, each thread gets a memory for storing the variables in it and plus they can access to the global variables which is common for all the thread. Eg.A Microsoft Word is a Application. When you open a word file,an instance of the Word starts and a process is allocated to this instance which has one thread.

What is the difference between an EXE and a DLL?
You can create an objects of Dll but not of the EXE.
Dll is an In-Process Component whereas EXE is an OUt-Process Component.
Exe is for single use whereas you can use Dll for multiple use.
Exe can be started as standalone where dll cannot be.

What is strong-typing versus weak-typing? Which is preferred? Why?
Strong typing implies that the types of variables involved in operations are associated to the variable, checked at compile-time, and require explicit conversion; weak typing implies that they are associated to the value, checked at run-time, and are implicitly converted as required. (Which is preferred is a disputable point, but I personally prefer strong typing because I like my errors to be found as soon as possible.)

What is a PID? How is it useful when troubleshooting a system?
PID is the process Id of the application in Windows. Whenever a process starts running in the Windows environment, it is associated with an individual process Id or PID.
The PID (Process ID) a unique number for each item on the Process Tab, Image Name list.
How do you get the PID to appear?
In Task Manger, select the View menu, then select columns and check PID (Process Identifier).
In Linux, PID is used to debug a process explicitly. However we cannot do this in a windows environment.
Microsoft has launched a SDK called as Microsoft Operations Management (MOM). This uses the PID to find out which dll’s have been loaded by a process in the memory. This is essentially helpful in situations where the Process which has a memory leak is to be traced to a erring dll. Personally I have never used a PID, our Windows debugger does the things required to find out.

What is the GAC? What problem does it solve?
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 that are to be shared by several applications on the computer. This area is typically the folder under windows or winnt in the machine.
All the assemblies that need to be shared across applications need to be done through the Global assembly Cache only. However it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
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.
GAC solves the problem of DLL Hell and DLL versioning. Unlike earlier situations, GAC can hold two assemblies of the same name but different version. This ensures that the applications which access a particular assembly continue to access the same assembly even if another version of that assembly is installed on that machine.

Describe what an Interface is and how it’s different from a Class.
An interface is a structure of code which is similar to a class. An interface is a prototype for a class and is useful from a logical design perspective. Interfaces provide a means to define the protocols for a class without worrying about the implementation details. The syntax for creating interfaces follows:

interface Identifier {
  InterfaceBody
}
Identifier is the name of the interface and InterfaceBody refers to the abstract methods and static final variables that make up the interface. Because it is assumed that all the methods in an interface are abstract, it isn't necessary to use the abstract keyword

An interface is a description of some of the members available from a class. In practice, the syntax typically looks similar to a class definition, except that there's no code defined for the methods — just their name, the arguments passed and the type of the value returned.

So what good is it? None by itself. But you create an interface so that classes will implement it.

But what does it mean to implement an interface. The interface acts as a contract or promise. If a class implements an interface, then it must have the properties and methods of the interface defined in the class. This is enforced by the compiler.
Broadly the differentiators between classes and interfaces is as follows
• Interface should not have any implementation.
• Interface can not create any instance.
• Interface should provide high level abstraction from the implementation.
• Interface can have multiple inheritances.
• Default access level of the interface is public.

What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
ASP.NET Web services and .NET Remoting provide a full suite of design options for cross-process and cross-plaform communication in distributed applications. In general, ASP.NET Web services provide the highest levels of interoperability with full support for WSDL and SOAP over HTTP, while .NET Remoting is designed for common language runtime type-system fidelity and supports additional data format and communication channels. Hence if we looking cross-platform communication than web services is the choice coz for .NET remoting .Net framework is requried which may or may not present for the other platform.

Serialization and Metadata
ASP.NET Web services rely on the System.Xml.Serialization.XmlSerializer class to marshal data to and from SOAP messages at runtime. For metadata, they generate WSDL and XSD definitions that describe what their messages contain. The reliance on pure WSDL and XSD makes ASP.NET Web services metadata portable; it expresses data structures in a way that other Web service toolkits on different platforms and with different programming models can understand. In some cases, this imposes constraints on the types you can expose from a Web service—XmlSerializer will only marshal things that can be expressed in XSD. Specifically, XmlSerializer will not marshal object graphs and it has limited support for container types.
.NET Remoting relies on the pluggable implementations of the IFormatter interface used by the System.Runtime.Serialization engine to marshal data to and from messages. There are two standard formatters, System.Runtime.Serialization.Formatters.Binary.BinaryFormatter and System.Runtime.Serialization.Formatters.Soap.SoapFormatter. The BinaryFormatter and SoapFormatter, as the names suggest, marshal types in binary and SOAP format respectively. For metadata, .NET Remoting relies on the common language runtime assemblies, which contain all the relevant information about the data types they implement, and expose it via reflection. The reliance on the assemblies for metadata makes it easy to preserve the full runtime type-system fidelity. As a result, when the .NET Remoting plumbing marshals data, it includes all of a class's public and private members; handles object graphs correctly; and supports all container types (e.g., System.Collections.Hashtable). However, the reliance on runtime metadata also limits the reach of a .NET Remoting system—a client has to understand .NET constructs in order to communicate with a .NET Remoting endpoint. In addition to pluggable formatters, the .NET Remoting layer supports pluggable channels, which abstract away the details of how messages are sent. There are two standard channels, one for raw TCP and one for HTTP. Messages can be sent over either channel independent of format.

Distributed Application Design: ASP.NET Web Services vs. .NET Remoting
ASP.NET Web services favor the XML Schema type system, and provide a simple programming model with broad cross-platform reach. .NET Remoting favors the runtime type system, and provides a more complex programming model with much more limited reach. This essential difference is the primary factor in determining which technology to use. However, there are a wide range of other design factors, including transport protocols, host processes, security, performance, state management, and support for transactions to consider as well.

Security
Since ASP.NET Web services rely on HTTP, they integrate with the standard Internet security infrastructure. ASP.NET leverages the security features available with IIS to provide strong support for standard HTTP authentication schemes including Basic, Digest, digital certificates, and even Microsoft® .NET Passport. (You can also use Windows Integrated authentication, but only for clients in a trusted domain.) One advantage of using the available HTTP authentication schemes is that no code change is required in a Web service; IIS performs authentication before the ASP.NET Web services are called. ASP.NET also provides support for .NET Passport-based authentication and other custom authentication schemes. ASP.NET supports access control based on target URLs, and by integrating with the .NET code access security (CAS) infrastructure. SSL can be used to ensure private communication over the wire.

Although these standard transport-level techniques to secure Web services are quite effective, they only go so far. In complex scenarios involving multiple Web services in different trust domains, you have to build custom ad hoc solutions. Microsoft and others are working on a set of security specifications that build on the extensibility of SOAP messages to offer message-level security capabilities. One of these is the XML Web Services Security Language (WS-Security), which defines a framework for message-level credential transfer, message integrity, and message confidentiality.

As noted in the previous section, the .NET Remoting plumbing does not secure cross-process invocations in the general case. A .NET Remoting endpoint hosted in IIS with ASP.NET can leverage all the same security features available to ASP.NET Web services, including support for secure communication over the wire using SSL. If you are using the TCP channel or the HTTP channel hosted in processes other than aspnet_wp.exe, you have to implement authentication, authorization and privacy mechanisms yourself.

One additional security concern is the ability to execute code from a semi-trusted environment without having to change the default security policy. ASP.NET Web Services client proxies work in these environments, but .NET Remoting proxies do not. In order to use a .NET Remoting proxy from a semi-trusted environment, you need a special serialization permission that is not given to code loaded from your intranet or the Internet by default. If you want to use a .NET Remoting client from within a semi-trusted environment, you have to alter the default security policy for code loaded from those zones. In situations where you are connecting to systems from clients running in a sandbox—like a downloaded Windows Forms application, for instance—ASP.NET Web Services are a simpler choice because security policy changes are not required.

Conceptually, what is the difference between early-binding and late-binding?
Early binding – Binding at Compile Time
Late Binding – Binding at Run Time
Early binding implies that the class of the called object is known at compile-time; late-binding implies that the class is not known until run-time, such as a call through an interface or via Reflection.
Early binding is the preferred method. It is the best performer because your application binds directly to the address of the function being called and there is no extra overhead in doing a run-time lookup. In terms of overall execution speed, it is at least twice as fast as late binding.
Early binding also provides type safety. When you have a reference set to the component's type library, Visual Basic provides IntelliSense support to help you code each function correctly. Visual Basic also warns you if the data type of a parameter or return value is incorrect, saving a lot of time when writing and debugging code.
Late binding is still useful in situations where the exact interface of an object is not known at design-time. If your application seeks to talk with multiple unknown servers or needs to invoke functions by name (using the Visual Basic 6.0 CallByName function for example) then you need to use late binding. Late binding is also useful to work around compatibility problems between multiple versions of a component that has improperly modified or adapted its interface between versions.

What is an Assembly Qualified Name? Is it a filename? How is it different?
An assembly qualified name isn't the filename of the assembly; it's the internal name of the assembly combined with the assembly version, culture, and public key, thus making it unique.
e.g. (""System.Xml.XmlDocument, System.Xml, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"")

How is a strongly-named assembly different from one that isn’t strongly-named?
Strong names are used to enable the stricter naming requirements associated with shared assemblies. These strong names are created by a .NET utility – sn.exe
Strong names have three goals:
· Name uniqueness. Shared assemblies must have names that are globally unique.
· Prevent name spoofing. Developers don't want someone else releasing a subsequent version of one of your assemblies and falsely claim it came from you, either by accident or intentionally.
· Provide identity on reference. When resolving a reference to an assembly, strong names are used to guarantee the assembly that is loaded came from the expected publisher.
Strong names are implemented using standard public key cryptography. In general, the process works as follows: The author of an assembly generates a key pair (or uses an existing one), signs the file containing the manifest with the private key, and makes the public key available to callers. When references are made to the assembly, the caller records the public key corresponding to the private key used to generate the strong name.
Weak named assemblies are not suitable to be added in GAC and shared. It is essential for an assembly to be strong named.
Strong naming prevents tampering and enables assemblies to be placed in the GAC alongside other assemblies of the same name.

How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
The hugely simplistic version is that every time it garbage-collects, it starts by assuming everything to be garbage, then goes through and builds a list of everything reachable. Those become not-garbage, everything else doesn't, and gets thrown away. What makes it generational is that every time an object goes through this process and survives, it is noted as being a member of an older generation (up to 2, right now). When the garbage-collector is trying to free memory, it starts with the lowest generation (0) and only works up to higher ones if it can't free up enough space, on the grounds that shorter-lived objects are more likely to have been freed than longer-lived ones.
Non-deterministic finalization implies that the destructor (if any) of an object will not necessarily be run (nor its memory cleaned up, but that's a relatively minor issue) immediately upon its going out of scope. Instead, it will wait until first the garbage collector gets around to finding it, and then the finalisation queue empties down to it; and if the process ends before this happens, it may not be finalised at all. (Although the operating system will usually clean up any process-external resources left open - note the usually there, especially as the exceptions tend to hurt a lot.)

What is the difference between Finalize() and Dispose()?
Dispose() is called by the user of an object to indicate that he is finished with it, enabling that object to release any unmanaged resources it holds. Finalize() is called by the run-time to allow an object which has not had Dispose() called on it to do the same. However, Dispose() operates determinalistically, whereas there is no guarantee that Finalize() will be called immediately when an object goes out of scope - or indeed at all, if the program ends before that object is GCed - and as such Dispose() is generally preferred.

How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
The using() pattern is useful because it ensures that Dispose() will always be called when a disposable object (defined as one that implements IDisposable, and thus the Dispose() method) goes out of scope, even if it does so by an exception being thrown, and thus that resources are always released.

What does this useful command line do? tasklist /m "mscor*"
Lists all the applications and associated tasks/process currently  running on the system with a module whose name begins "mscor" loaded into them; which in nearly all cases means "all the .NET processes".

What’s wrong with a line like this? DateTime.Parse(myString);
Therez nothing wrong with this declaration.Converts the specified string representation of a date and time to its DateTime equivalent.But If the string is not a valid DateTime,It throws an exception.

What are PDBs? Where must they be located for debugging to work?
A program database (PDB) files holds debugging and project state information that allows incremental linking of debug configuration of your program.There are several different types of symbolic debugging information. The default type for Microsoft compiler is the so-called PDB file. The compiler setting for creating this file is /Zi, or /ZI for C/C++(which creates a PDB file with additional information that enables a feature called ""Edit and Continue"") or a Visual Basic/C#/JScript .NET program with /debug.
A PDB file is a separate file, placed by default in the Debug project subdirectory, that has the same name as the executable file with the extension .pdb. Note that the Visual C++ compiler by default creates an additional PDB file called VC60.pdb for VisulaC++6.0 and VC70.PDB file for VisulaC++7.0. The compiler creates this file during compilation of the source code, when the compiler isn't aware of the final name of the executable. The linker can merge this temporary PDB file into the main one if you tell it to, but it won't do it by default. The PDB file can be useful to display the detailed stack trace with source files and line numbers.

What is FullTrust? Do GAC’ed assemblies have FullTrust?
Before the .NET Framework existed, Windows had two levels of trust for downloaded code. This old model was a binary trust model. You only had two choices: Full Trust, and No Trust. The code could either do anything you could do, or it wouldn't run at all.

The permission sets in .NET include FullTrust, SkipVerification, Execution, Nothing, LocalIntranet, Internet and Everything. Full Trust Grants unrestricted permissions to system resources. Fully trusted code run by a normal, nonprivileged user cannot do administrative tasks, but can access any resources the user can access, and do anything the user can do. From a security standpoint, you can think of fully trusted code as being similar to native, unmanaged code, like a traditional ActiveX control.
GAC assemblies are granted FullTrust. In v1.0 and 1.1, the fact that assemblies in the GAC seem to always get a FullTrust grant is actually a side effect of the fact that the GAC lives on the local machine.  If anyone were to lock down the security policy by changing the grant set of the local machine to something less than FullTrust, and if your assembly did not get extra permission from some other code group, it would no longer have FullTrust even though it lives in the GAC.

What does this do? gacutil /l | find /i "Corillian"
The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache.The tool comes with various optional params to do that.
""/l"" option Lists the contents of the global assembly cache. If you specify the assemblyName parameter(/l [assemblyName]), the tool lists only the assemblies matching that name.

What does this do .. sn -t foo.dll ?
Sn -t option displays the token for the public key stored in infile. The contents of infile must be previously generated using -p.
Sn.exe computes the token using a hash function from the public key. To save space, the common language runtime stores public key tokens in the manifest as part of a reference to another assembly when it records a dependency to an assembly that has a strong name. The -tp option displays the public key in addition to the token.

How do you generate a strong name?
.NET provides an utility called strong name tool. You can run this toolfrom the VS.NET command prompt to generate a strong name with an option "-k" and providing the strong key file name. i.e. sn- -k < file-name >

What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
The Debug build is the program compiled with full symbolic debug information and no optimization. The Release build is the program compiled employing  optimization and contains no symbolic debug information. These settings can be changed as per need from Project Configuration properties. The release runs faster since it does not have any debug symbols and is optimized.

Explain the use of virtual, sealed, override, and abstract.
Abstract: The keyword can be applied for a class or method.
1. Class: If we use abstract keyword for a class it makes the
class an abstract class, which means it cant be instantiated. Though
it is not nessacary to make all the method within the  abstract class to be virtual. ie, Abstract class can have concrete methods
2. Method: If we make a method as abstract, we dont need to provide implementation
of the method in the class but the derived class need to implement/override this method.

Sealed: It can be applied on a class and methods. It stops the type from further derivation i.e no one can derive class from a sealed class,ie A sealed class cannot be inherited.A sealed class cannot be a abstract class.A compile time error is thrown if you try to specify sealed class as a  base class.
When an instance method declaration includes a sealed modifier, that method is said to be a sealed method. If an instance method declaration includes the sealed modifier, it must also include the override modifier. Use of the sealed modifier prevents a derived class from further overriding the method  For Egs: sealed override public void Sample() { Console.WriteLine("Sealed Method"); }
Virtual & Override: Virtual & Override keywords provides runtime polymorphism. A base class can make some of its methods as virtual which allows the derived class a chance to override the base class implementation by using override keyword.

For e.g. class Shape
  {
  int a
  public virtual void Display()
  {
   Console.WriteLine("Shape");
  }
 }

 class Rectangle:Shape
 {
  public override void Display()
  {
   Console.WriteLine("Derived");
  }
 }

Explain the importance and use of each, Version, Culture and PublicKeyToken for an assembly.
This three alongwith name of the assembly provide a strong name or fully qualified name to the assembly. When a assebly is referenced with all three.
PublicKeyToken: Each assembly can have a public key embedded in its manifest that identifies the developer. This ensures that once the assembly ships, no one can modify the code or other resources contained in the assembly.

Culture: Specifies which culture the assembly supports

Version: The version number of the assembly.It is of the following form major.minor.build.revision.

Explain the differences between public, protected, private and internal. ?
These all are access modifier and they governs the access level. They can be applied to class, methods, fields.

Public: Allows class, methods, fields to be accessible from anywhere i.e. within and outside an assembly.
Private: When applied to field and method allows to be accessible within a class.
Protected: Similar to private but can be accessed by members of derived class also.
Internal: They are public within the assembly i.e. they can be accessed by anyone within an assembly but outside assembly they are not visible.

What is the difference between typeof(foo) and myFoo.GetType()?
Typeof is operator which applied to a object returns System.Type object. Typeof cannot be overloaded white GetType has lot of overloads.GetType is a method which also returns System.Type of an object. GetType is used to get the runtime type of the object.
Example from MSDN showing Gettype used to retrive type at untime:-
public class MyBaseClass: Object {
}
public class MyDerivedClass: MyBaseClass {
}
public class Test {
public static void Main() {
     MyBaseClass myBase = new MyBaseClass();
     MyDerivedClass myDerived = new MyDerivedClass();
     object o = myDerived;
      MyBaseClass b = myDerived;
      Console.WriteLine("mybase: Type is {0}", myBase.GetType());
      Console.WriteLine("myDerived: Type is {0}", myDerived.GetType());
      Console.WriteLine("object o = myDerived: Type is {0}", o.GetType());
      Console.WriteLine("MyBaseClass b = myDerived: Type is {0}", b.GetType());
   }
}
/*This code produces the following output.
mybase: Type is MyBaseClass
myDerived: Type is MyDerivedClass
object o = myDerived: Type is MyDerivedClass
MyBaseClass b = myDerived: Type is MyDerivedClass */
Can "this" be used within a static method?
No 'This' cannot be used in a static method. As only static variables/methods can be used in a static method.

What is the purpose of XML Namespaces?
An XML Namespace is a collection of element types and attribute names. It consists of 2 parts
1) The first part is the URI used to identify the namespace
2) The second part is the element type or attribute name itself.
Together they form a unique name. The various purpose of XML Namespace are
1. Combine fragments from different documents without any naming conflicts. (See example below.)
2. Write reusable code modules that can be invoked for specific elements and attributes. Universally unique names guarantee that
such modules are invoked only for the correct elements and attributes.
3. Define elements and attributes that can be reused in other schemas or instance documents without fear of name collisions. For
example, you might use XHTML elements in a parts catalog to provide part descriptions. Or you might use the nil attribute
defined in XML Schemas to indicate a missing value.
< Department >
     < Name >DVS1< /Name >
     < addr:Address xmlns:addr="http://www.tu-darmstadt.de/ito/addresses" >
        < addr:Street >Wilhelminenstr. 7< /addr:Street >
        < addr:City >Darmstadt< /addr:City >
        < addr:State >Hessen< /addr:State >
        < addr:Country >Germany< /addr:Country >
        < addr:PostalCode >D-64285< /addr:PostalCode >
     < /addr:Address >
     < serv:Server xmlns:serv="http://www.tu-darmstadt.de/ito/servers" >
        < serv:Name >OurWebServer< /serv:Name >
        < serv:Address >123.45.67.8< /serv:Address >
     < /serv:Server >
  < /Department >

What is difference between MetaData and Manifest ?
Metadata and Manifest forms an integral part of an assembly( dll / exe ) in .net framework .
Out of which Metadata is a mandatory component , which as the name suggests gives the details about various components of IL code viz : Methods , properties , fields , class etc.
Essentially Metadata maintains details in form of tables like Methods Metadata tables , Properties Metadata tables , which maintains the list of given type and other details like access specifier , return type etc.
Now Manifest is a part of metadata only , fully called as “manifest metadata tables” , it contains the details of the references needed by the assembly of any other external assembly / type , it could be a custom assembly or standard System namespace .
Now for an assembly that can independently exists and used in the .Net world both the things ( Metadata with Manifest ) are mandatory , so that it can be fully described assembly and can be ported anywhere without any system dependency . Essentially .Net framework can read all assembly related information from assembly itself at runtime .
But for .Net modules , that can’t be used independently , until they are being packaged as a part of an assembly , they don’t contain Manifest but their complete structure is defined by their respective metadata .
Ultimately .Net modules use Manifest Metadata tables of parent assembly which contain them.

What is the use of Internal keyword?
Internal keyword is one of the access specifier available in .Net framework , that makes a type visible in a  given assembly , for e.g : a single dll can contain multiple modules , essentially a multi file assembly , but it forms a single binary component , so any type with internal keyword will be visible throughout the assembly and can be used in any of the modules .

What actually happes when you add a something to arraylistcollection ?
Following things will happen :
Arraylist is a dynamic array class in c# in System.Collections namespace derived from interfaces – ICollection , IList , ICloneable , IConvertible  . It terms of in memory structure following is the implementation .
a. Check up the total space if there’s any free space on the declared list .
b. If yes add the new item and increase count by 1 .
c. If No Copy the whole thing to a temporary Array of Last Max. Size .
d. Create new Array with size ( Last Array Size + Increase Value )
e. Copy back values from temp and reference this new array as original array .
f. Must doing Method updates too , need to check it up .

What is Boxing and unboxing? Does it occure automaatically or u need to write code to box and unbox?
Boxing – Process of converting a System.ValueType to Reference Type , Mostly base class System.Object type and allocating it memory on Heap .Reverse is unboxing , but can only be done with prior boxed variables.
Boxing is always implicit but Unboxing needs to be explicitly done via casting , thus ensuring the value type contained inside .

How Boxing and unboxing occures in memory?
Boxing converts value type to reference type , thus allocating memory on Heap . Unboxing converts already boxed reference types to value types through explicit casting , thus  allocating memory on stack .

Why only boxed types can be unboxed?
Unboxing is the process of converting a Reference type variable to Value type and thus allocating memory on the stack . It happens only to those Reference type variables that have been earlier created by Boxing of a Value Type , therefore internally they contain a value type , which can be obtained through explicit casting . For any other Reference type , they don’t internally contain a Value type to Unboxed via explicit casting . This is why only boxed types can be unboxed.

*********************************************************************************

ASP.NET Interview Questions

1.Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.

inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

2.What’s the difference between Response.Write() and Response.Output.Write()?
Response.Output.Write() allows you to write formatted output.
 
3.What methods are fired during the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.
 
4.When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.
 
5.What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page
 
6.Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture
 
7.What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.
 
8.What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
 
9.Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button.  Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
 
10.What data types do the RangeValidator control support?
Integer, String, and Date.
 
11.Explain the differences between Server-side and Client-side code?
Server-side code executes on the server.  Client-side code executes in the client's browser.
 
12.What type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server.  However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser.  But just to be clear, code-behind executes on the server, thus making it server-side code.
 
13.Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum.  Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.
 
14.What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser.  This provides a faster response with a little less overhead on the server.  Server.Transfer does not update the clients url history list or current url.  Response.Redirect is used to redirect the user's browser to another page or site.  This performas a trip back to the client where the client's browser is redirected to the new page.  The user's browser history list is updated to reflect the new address.
 
15.Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
·  A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
·  A DataSet is designed to work without any continuing connection to the original data source.
·  Data in a DataSet is bulk-loaded, rather than being loaded on demand.
·  There's no concept of cursor types in a DataSet.
·  DataSets have no current record pointer You can use For Each loops to move through the data.
·  You can store many edits in a DataSet, and write them to the original data source in a single operation.
·  Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
 
16.What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
 
17.What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.
 
18.Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class.  Example: With a base class named Employee, a Manager class could be derived from the Employee base class.
 
19.Whats an assembly?
Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN
 
20.Describe the difference between inline and code behind.
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
 
21.Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML.  A good use is reading database data to an XML file to be sent to a Web Service.
 
22.Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.  MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.
 
23.Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.
 
24.Can you edit data in the Repeater control?
No, it just reads the information from its data source.
 
25.Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.
 
26.How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.
 
27.What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.
 
28.What base class do all Web Forms inherit from?
The Page class.
 
29.Name two properties common in every validation control?
ControlToValidate property and Text property.
 
30.Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property.
 
31.Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control.
 
32.How many classes can a single .NET DLL contain?
It can contain many classes.

*************************************************************************************

Web Service Questions

1.What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol.
 
2.True or False: A Web service can only be written in .NET?
False
 
3.What does WSDL stand for?
Web Services Description Language.
 
4.Where on the Internet would you look for Web services?
http://www.uddi.org
 
5.True or False: To test a Web service you must create a Windows application or Web application to consume this service?
False, the web service comes with a test page and it provides HTTP-GET method to test.

************************************************************************************

State Management Questions

1.What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.  ViewState is used the retain the state of server-side objects between postabacks.
 
2.What is the lifespan for items stored in ViewState?
Item stored in ViewState exist for the life of the current page.  This includes postbacks (to the same page).
 
3.What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks.  It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser.  When the page is posted back to the server the server control is recreated with the state stored in viewstate.
 
4.What are the different types of Session state management options available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management.  In-Process stores the session in memory on the web server.  This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server.  Out-of-Process Session state management stores data in an external data source.  The external data source may be either a SQL Server or a State Server service.  Out-of-Process state management requires that all objects stored in session are serializable.

************************************************************************************

.NET Remoting Interview Questions

1.What’s a Windows process?
It’s an application that’s running and had been allocated memory.
 
2.What’s typical about a Windows process in regards to memory allocation?
Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
 
3.Explain what relationship is between a Process, Application Domain, and Application?
A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.
  
4.What are possible implementations of distributed applications in .NET?
.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.
 
5.What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?
Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process.  Web Services provide an open-protocol-based exchange of informaion.  Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.
  
6.What’s a proxy of the server object in .NET Remoting?
It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling.
 
7.What are remotable objects in .NET Remoting?
Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.
 
8.What are channels in .NET Remoting?
Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.
 
9.What security measures exist for .NET Remoting in System.Runtime.Remoting?
None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.
 
10.What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
 
11.Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.
 
12.What’s SingleCall activation mode used for?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.
 
13.What’s Singleton activation mode?
A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.
 
14.How do you define the lease of the object?
By implementing ILease interface when writing the class code.
 
15.Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.
 
16.How can you automatically generate interface for the remotable object in .NET with Microsoft tools?
Use the Soapsuds tool.

*************************************************************************************

C# Interview Questions

1.Does C# support multiple-inheritance?
No.
 
2.Who is a protected class-level variable available to?
It is available to any sub-class (a class inheriting this class).
 
3.Are private class-level variables inherited?
Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited.
 
4.Describe the accessibility modifier “protected internal”.
It is available to classes that are within the same assembly and derived from the specified base class.
 
5.What’s the top .NET class that everything is derived from?
System.Object.
 
6.What does the term immutable mean?
The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.
 
7.What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable.  System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
 
8.What’s the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time a string is changed, a new instance in memory is created.
 
9.Can you store multiple data types in System.Array?
No.
 
10.What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array.  The CopyTo() method copies the elements into another existing array.  Both perform a shallow copy.  A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.  A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.
 
11.How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.
 
12.What’s the .NET collection class that allows an element to be accessed using a unique key?
HashTable.
 

13.What class is underneath the SortedList class?A sorted HashTable.
 
14.Will the finally block get executed if an exception has not occurred?­
Yes.
 
15.What’s the C# syntax to catch any possible exception?
A catch block that catches the exception of type System.Exception.  You can also omit the parameter data type in this case and just write catch {}.
 
16.Can multiple catch blocks be executed for a single try statement?
No.  Once the proper catch block processed, control is transferred to the finally block (if there are any).
 
17.Explain the three services model commonly know as a three-tier application.
Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).

************************************************************************************
 
Class Questions

1.What is the syntax to inherit from a class in C#?
Place a colon and then the name of the base class.
Example: class MyNewClass : MyBaseClass
 
2.Can you prevent your class from being inherited by another class?
Yes.  The keyword “sealed” will prevent the class from being inherited.
 
3.Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes.  Just leave the class public and make the method sealed.
 
4.What’s an abstract class?
A class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden.  An abstract class is essentially a blueprint for a class without any implementation.
 
5.When do you absolutely have to declare a class as abstract?
1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
2.  When at least one of the methods in the class is abstract.
 
6.What is an interface class?
Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.
 
7.Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public, and are therefore public by default.
 
8.Can you inherit multiple interfaces?
Yes.  .NET does support multiple interfaces.
 
9.What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.
To Do: Investigate
 
10.What’s the difference between an interface and abstract class?
In an interface class, all methods are abstract - there is no implementation.  In an abstract class some methods can be concrete.  In an interface class, no accessibility modifiers are allowed.  An abstract class may have accessibility modifiers.
 
11.What is the difference between a Struct and a Class?
Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval.  Another difference is that structs cannot inherit.
 
***********************************************************************************

Method and Property Questions

1.What’s the implicit name of the parameter that gets passed into the set method/property of a class?
Value.  The data type of the value parameter is defined by whatever data type the property is declared as.
 
2.What does the keyword “virtual” declare for a method or property?
The method or property can be overridden.
 
3.How is method overriding different from method overloading?
When overriding a method, you change the behavior of the method for the derived class.  Overloading a method simply involves having another method with the same name within the class.
 
4.Can you declare an override method to be static if the original method is not static?
No.  The signature of the virtual method must remain the same.  (Note: Only the keyword virtual is changed to keyword override)
 
5.What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.
 
6.If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

************************************************************************************

Events and Delegates

1.What’s a delegate?
A delegate object encapsulates a reference to a method.
 
2.What’s a multicast delegate?
A delegate that has multiple handlers assigned to it.  Each assigned handler (method) is called.

***********************************************************************************

XML Documentation Questions

1.Is XML case-sensitive?
Yes.
 
2.What’s the difference between // comments, /* */ comments and /// comments?
Single-line comments, multi-line comments, and XML documentation comments.
 
3.How do you generate documentation from the C# file commented properly with a command-line compiler?
Compile it with the /doc switch.

************************************************************************************

Debugging and Testing Questions

1.What debugging tools come with the .NET SDK?
1. CorDBG – command-line debugger.  To use CorDbg, you must compile the original C# file using the /debug switch.
2. DbgCLR – graphic debugger.  Visual Studio .NET uses the DbgCLR.
 
2.What does assert() method do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false.  The program proceeds without any interruption if the condition is true.
 
3.What’s the difference between the Debug class and Trace class?
Documentation looks the same.  Use Debug class for debug builds, use Trace class for both debug and release builds.
 
4.Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose.  For applications that are constantly running you run the risk of overloading the machine and the hard drive.  Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.
 
5.Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.
 
6.How do you debug an ASP.NET Web application?
Attach the aspnet_wp.exe process to the DbgClr debugger.
 
7.What are three test cases you should go through in unit testing?
1.       Positive test cases (correct data, correct output).
2.       Negative test cases (broken or missing data, proper handling).
3.       Exception test cases (exceptions are thrown and caught properly).
 
8.Can you change the value of a variable while debugging a C# application?
Yes.  If you are debugging via Visual Studio.NET, just go to Immediate window.

***********************************************************************************

ADO.NET and Database Questions

1.What is the role of the DataReader class in ADO.NET connections?
It returns a read-only, forward-only rowset from the data source.  A DataReader provides fast access when a forward-only sequential read is needed.
 
2.What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix.  OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.
 
3.What is the wildcard character in SQL?
Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
 
4.Explain ACID rule of thumb for transactions.
A transaction must be:
1.       Atomic - it is one unit of work and does not dependent on previous and following transactions.
2.       Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.
3.       Isolated - no transaction sees the intermediate results of the current transaction).
4.       Durable - the values persist if the data had been committed even if the system crashes right after.
 
5.What connections does Microsoft SQL Server support?
Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).
 
6.Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
 
7.What does the Initial Catalog parameter define in the connection string?
The database name to connect to.
  
8.What does the Dispose method do with the connection object?
Deletes it from the memory.
 
9.What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.  The connection string must be identical.

*********************************************************************************

Assembly Questions

1.How is the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
 
2.What are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.
 
3.What is a satellite assembly?
When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
 
4.What namespaces are necessary to create a localized application?
System.Globalization and System.Resources.
 
5.What is the smallest unit of execution in .NET?
an Assembly.
 
6.When should you call the garbage collector in .NET?
As a good rule, you should not call the garbage collector.  However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory.  However, this is usually not a good practice.
 
7.How do you convert a value-type to a reference-type?
Use Boxing.
 
8.What happens in memory when you Box and Unbox a value-type?
Boxing converts a value-type to a reference-type, thus storing the object on the heap.  Unboxing converts a reference-type to a value-type, thus storing the value on the stack.

**********************************************************************************

ASP.NET DataGrid questions

1.What is datagrid?
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.

2.What’s the difference between the System.Web.UI.WebControls.DataGrid and and System.Windows.Forms.DataGrid?
The Web UI control does not inherently support master-detail data structures. As with other Web server controls, it does not support two-way data binding. If you want to update data, you must write code to do this yourself. You can only edit one row at a time. It does not inherently support sorting, although it raises events you can handle in order to sort the grid contents. You can bind the Web Forms DataGrid to any object that supports the IEnumerable interface. The Web Forms DataGrid control supports paging. It is easy to customize the appearance and layout of the Web Forms DataGrid control as compared to the Windows Forms one.

3.How do you customize the column content inside the datagrid?
If you want to customize the content of a column, make the column a template column. Template columns work like item templates in the DataList or Repeater control, except that you are defining the layout of a column rather than a row.

4.How do you apply specific formatting to the data inside the cells?
You cannot specify formatting for columns generated when the grid’s AutoGenerateColumns property is set to true, only for bound or template columns. To format, set the column’s DataFormatString property to a string-formatting expression suitable for the data type of the data you are formatting.

5.How do you hide the columns?
One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s Visible property.

6.How do you display an editable drop-down list?
Displaying a drop-down list requires a template column in the grid. Typically, the ItemTemplate contains a control such as a data-bound Label control to show the current value of a field in the record. You then add a drop-down list to the EditItemTemplate. In Visual Studio, you can add a template column in the Property builder for the grid, and then use standard template editing to remove the default TextBox control from the EditItemTemplate and drag a DropDownList control into it instead. Alternatively, you can add the template column in HTML view. After you have created the template column with the drop-down list in it, there are two tasks. The first is to populate the list. The second is to preselect the appropriate item in the list — for example, if a book’s genre is set to “fiction,” when the drop-down list displays, you often want “fiction” to be preselected.

7.How do you check whether the row data has been changed?
The definitive way to determine whether a row has been dirtied is to handle the changed event for the controls in a row. For example, if your grid row contains a TextBox control, you can respond to the control’s TextChanged event. Similarly, for check boxes, you can respond to a CheckedChanged event. In the handler for these events, you maintain a list of the rows to be updated. Generally, the best strategy is to track the primary keys of the affected rows. For example, you can maintain an ArrayList object that contains the primary keys of the rows to update.

*********************************************************************************

Windows code security questions

1.What’s the difference between code-based security and role-based security?
Which one is better?

Code security is the approach of using permissions and permission sets for a given code to run. The admin, for example, can disable running executables off the Internet or restrict access to corporate database to only few applications. Role-based security most of the time involves the code running with the privileges of the current user. This way the code cannot supposedly do more harm than mess up a single user account. There’s no better, or 100% thumbs-up approach, depending on the nature of deployment, both code-based and role-based security could be implemented to an extent.

2.How can you work with permissions from your .NET application?
You can request permission to do something and you can demand certain permissions from other apps. You can also refuse permissions so that your app is not inadvertently used to destroy some data.

3.How can C# app request minimum permissions?
using System.Security.Permissions;
[assembly:FileDialogPermissionAttribute(SecurityAction.RequestMinimum, Unrestricted=true)]

4.What’s a code group?
A code group is a set of assemblies that share a security context.

5.What’s the difference between authentication and authorization?
Authentication happens first. You verify user’s identity based on credentials. Authorization is making sure the user only gets access to the resources he has credentials for.

6.What are the authentication modes in ASP.NET?
None, Windows, Forms and Passport.

7.Are the actual permissions for the application defined at run-time or compile-time?
The CLR computes actual permissions at runtime based on code group membership and the calling chain of the code.

**********************************************************************************

NET Deployment questions

1.What do you know about .NET assemblies?
Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET remoting applications.

2.What’s the difference between private and shared assembly?
Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.

3.What’s a strong name?
A strong name includes the name of the assembly, version number, culture identity, and a public key token.

4.How can you tell the application to look for assemblies at the locations other than its own install?
Use the
directive in the XML .config file for a given application.



should do the trick. Or you can add additional search paths in the Properties box of the deployed application.

5.How can you debug failed assembly binds?
Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.

6.Where are shared assemblies stored?
Global assembly cache.

7.How can you create a strong name for a .NET assembly?
With the help of Strong Name tool (sn.exe).

8.Where’s global assembly cache located on the system?
Usually C:\winnt\assembly or C:\windows\assembly.

9.Can you have two files with the same file name in GAC?
Yes, remember that GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so it’s possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version 1.0.0.0 and the second one is 1.1.0.0.

10.So let’s say I have an application that uses MyApp.dll assembly, version 1.0.0.0. There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll 1.1.0.0. How do I tell the client applications that are already installed to start using this new MyApp.dll?
Use publisher policy. To configure a publisher policy, use the publisher policy configuration file, which uses a format similar app .config file. But unlike the app .config file, a publisher policy file needs to be compiled into an assembly and placed in the GAC.

11.What is delay signing?
Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.

Labels: ,

23 Comments:

At October 14, 2015 at 11:46 PM , Blogger Yatika Dhingra said...

Thank you very much for this webpage. It means a lot to me and it is the most beauiful.!
Dealnity is the World Largest B2B Data Base Company in Delhi Offer

 
At March 23, 2016 at 3:42 AM , Blogger Sathya G said...

the blog is about the dotnet library is very informative and useful. thank you for sharing the blog with us.
Dotnet Training in Chennai

 
At April 6, 2016 at 3:28 AM , Blogger Harini R said...

thanks for sharing wonderful blog with us. its really more helpful to our institute candidates to get aware some useful knowledge keep sharing more information.
Dot Net training in Chennai

 
At May 11, 2016 at 12:07 AM , Blogger Keerthi vijay said...

This idea is mind blowing. I think everyone should know such information like you have described on this post. Thank you for sharing this explanation.Your final conclusion was good. We are sowing seeds and need to be patiently wait till it blossoms.

CCNA Training in Chennai

 
At May 27, 2016 at 5:37 AM , Blogger Camellia Canan said...





I have been following you for a couple of months now but this is my first time commenting on a blog post. Thank you for sharing your knowledge and experience with us. Keep up the good work. Already bookmarked for future reference.

SAP training in Chennai

 
At June 16, 2016 at 2:07 AM , Anonymous Maani kamili said...

Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it. What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity..

Digital marketing company in Chennai

 
At June 28, 2016 at 7:10 AM , Blogger Suseela Susiee said...


Great and useful article. Creating content regularly is very tough. Your points are motivated me to move on.


SEO Company in Chennai

 
At July 6, 2016 at 6:33 AM , Blogger Saki R said...

thanks for shared wonderful information of giving best information.its more useful and more helpful. great doing keep sharing
PHP Training in Chennai Adyar

 
At July 27, 2016 at 3:41 AM , Blogger Sathya G said...

this is really a very great blog. the information present in this blog will be very useful for us. thank you for sharing with us.
ROI Services in Chennai

 
At July 29, 2016 at 11:53 PM , Blogger Rekhila said...

This is really a very good article. Thanks for taking the time to discuss with us, I feel happy about learning this topic. keep sharing your information regularly for my future reference.
Branding Services in Chennai

 
At August 26, 2016 at 7:23 AM , Blogger Suseela Susiee said...


All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.



Manual testing training in Chennai

Selenium training in Chennai

Software testing training in Chennai

 
At October 25, 2016 at 7:28 AM , Anonymous Padhma said...

I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
Home Spa Services in Mumbai

 
At December 30, 2016 at 9:52 PM , Blogger Jeffy said...

Thank you for sharing such a nice and interesting blog with us. Hope it might be much useful for us. keep on updating...!!
seo company in india
digital marketing company in india
seo company in chennai
digital marketing company in chennai

 
At January 5, 2017 at 8:46 PM , Blogger Shalini said...

Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
seo company in india

 
At January 23, 2017 at 11:17 PM , Blogger karthik anu said...


This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
iOS Training in Chennai
Android Training in Chennai
php Training in Chennai

 
At January 31, 2017 at 11:00 PM , Blogger Aasha said...

This blog having the details of Processes running. The way of runing is explained clearly. The content quality is really great. The full document is entirely amazing. Thank you very much for this blog.
web Design Company in Chennai

 
At February 6, 2017 at 3:30 AM , Anonymous Anu said...


I’ve been browsing on-line greater than three hours today, but I never discovered any attention-grabbing article like yours. It is beautiful worth sufficient for me. Personally, if all webmasters and bloggers made good content material as you did, the net will be a lot more helpful than ever before.
iOS Training in Chennai
Android Training in Chennai
php Training in Chennai

 
At March 4, 2017 at 1:49 AM , Blogger Webtrackker Noida said...

Webtrackker technology is the best IT training institute in NCR. Webtrackker provide training on all latest technology such as dot net training. Webtrackker is not only training institute but also it also provide best IT solution to his client. Webtrackker provide training by experienced and working in the industry on same technology.Webtrackker Technology C-67 Sector-63 Noida 8802820025

dot net training institute in indirapuram


dot net Training institute in Noida


Dot net Training institute in Ghaziabad


dot net training institute in Vaishali


dot net Training institute in Vasundhara


dot net Training institute in Delhi South Ex

 
At March 7, 2017 at 10:32 PM , Blogger Thamizharasi J said...

Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

Fresher Jobs in Chennai
Fresher Jobs in Delhi
Fresher Jobs in Bangalore
Fresher Jobs in Kolkata

 
At March 23, 2017 at 5:32 AM , Blogger Guhan said...

Thank you for your post. I found your blog more informative and useful.

IOS training in chennai

 
At May 9, 2017 at 8:35 PM , Blogger Lunameadow said...

I think great site for these post and i am read the most of contents have useful for my Carrier.Thanks for these useful information.Any information are commands like to share him.

Oracle Training in Chennai

 
At May 23, 2017 at 11:21 PM , Blogger preethi s said...

This is really a very nice article.Given so much information in it. its very useful .perfect explanation about Dot net library.Thanks for your valuable information.
dot net training in chennai velachery

 
At July 31, 2017 at 3:46 AM , Blogger Shalini said...


Really Good blog post on dot net library.provided a helpful information.I hope that you will post more updates like this.
Digital marketing company in Chennai

 

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home