Monday, May 9, 2011

General .NET Interview Questions

Ans : The class from which other classes derive fundamental functionality is called a base class. For e.g. If Class Y derives from Class X, then Class X is a base class.

The class which derives functionality from a base class is called a derived class. If Class Y derives from Class X, then Class Y is a derived class.

What is an extender class?

Ans : An extender class allows you to extend the functionality of an existing control. It is used in Windows forms applications to add properties to controls.

They allow you to extend the functionality of a .NET control class.

How do you prevent a class from being inherited?

Ans : In VB.NET you use the NotInheritable modifier to prevent programmers from using the class as a base class. In C#, use the sealed keyword.

What is a sealed class?

Ans : A sealed class is a class that cannot be inherited from. This means, If you have a class called Customer that is marked as sealed. No other class can inherit from Customer class. For example, the below code generates a compile time error "MainClass cannot derive from sealed type Customer.

using System;

public sealed class Customer

{

}

public class MainClass : Customer

{

public static void Main()

{

}

}

What are abstract methods?

Ans : Abstract methods are methods that only the declaration of the method and no implementation.

What is a connection pool?

Ans : A connection pool is a ‘collection of connections’ which are shared between the clients requesting one. Once the connection is closed, it returns back to the pool. This allows the connections to be reused.

What is the global assembly cache (GAC)?

Ans : GAC is a machine-wide cache of assemblies that allows .NET applications to share libraries.

Where do custom controls reside?

Ans : In the global assembly cache (GAC).

What is Boxing/Unboxing?

Ans : Boxing is used to convert value types to object.

E.g. int x = 1;

object obj = x ;

Unboxing is used to convert the object back to the value type.

E.g. int y = (int)obj;

Boxing/unboxing is quiet an expensive operation.

What is garbage collection?

Ans : Garbage collection is the process of managing the allocation and release of memory of objects in your applications which are no longer in use.

What is globalization?

Ans : Globalization is the process of customizing applications that support multiple cultures and regions.

What is localization?

Ans : Localization is the process of customizing applications that support a given culture and regions.