What is Polymorphism?
Polymorphism - Poly means "many" So it is one name and many forms.
In C# we have two types of polymorphism compile time and run time.
Compile time polymorphism is achieved through Function Overloading (Same function but different parameters or signatures) and
Run time polymorphism is achieved through function overriding also called shadowing in VB.net where a
child class method overrides the base class function.
How is the memory managed in C#?
By garbage collector or using dispose method of objet u can do memory management in c# .garbage collector is automatically remove object which is not use. This is new concept in c#.
Can two catch blocks be executed?
using System;
class a
{
public static void Main ()
{
int a=8;
int b=0;
int [] arr=new int[]{1,2};
try
{
Console.WriteLine(a/b);
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
Console.WriteLine("Hello");
}
finally
{ try
{
Console.WriteLine(arr[2]);
}
catch(IndexOutOfRangeException d)
{
Console.WriteLine(d.ToString ()+ "hello");
Console.WriteLine("Hello");
}
}
}
}
output will be
----------------
System.DivideByZeroException: Attempted to divide by zero.
at a.Main()
Hello
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at a.Main()
Hello
What is Sealed Class?
Sealed Class:
When applied to a class, the sealed modifier prevents other classes from inheriting from it.
In the following example,
class B inherits from class A, but no class can inherit
from class B.
class A {}
sealed class B : A {}
You can also use the sealed modifier on a method or property that overrides a virtual method or property in a base class. This enables you to allow classes to derive
from your class and prevent them from overriding specific virtual methods or properties.
What is early binding and late binding?
Early binding - Assigning values to variables during design time or exposing object model at design time.
Late Binding - Late binding has the same effect as early binding. The difference is that you bind the object library in code at run-time.
What is master pages how to use it. Please give one example In code vice?
Master page is inbuilt functionality in .Net2.0 or above. While in .Net1.1 you must be create custom master page using web user controls.
If you want to display the same section on more then one page in your application then you can use master page. A master page have content place holder where you can put your code for different pages.
To use master page in your web application pages, you must be include master page file name in the page directive. Like:
<@ page MasterPage="MyMasterpage.master" .......>
How to delete duplicate records from table in sql server 2005?
SELECT col1,col2 FROM GROUP BY col1,col2 HAVING COUNT(*) > 1
Any exceptions are there which are not caught by any catch blocks? What are they?
Yes,"StackOverFlowException" doesn't get catch by any catch block and Fatal Errors, Virtual memory.
What are the two kinds of properties?
Read only (with no 'set')
Write only (with no 'get')
What is read only and constant?
Constant : it will take the values at compile time, In constant u cant change values.
Read-Only : it will take values at run time especially u can use this for date functions.
Friday, March 26, 2010
Interview Panel : Mostly Asked Interview Questions in .Net
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment