Interview Questions and Answer in ASP.Net - Part1

1. Basic C# and ASP.Net Interview Questions.

Q. How can you store different data type in an Array?
Ans. Yes, by creating object of array
object[] array = new object[3];
array[0] = 1;
array[1] = "SharePointCafe";

Q. What is jagged array?
Ans. Jagged array is an array of array.
string[][] arr = new string[2][]
arr[0] = new string[2];
arr[1] = new string[1];

arr[0][0] = "Test";
arr[0][1] = "Test1";
arr[1][0] = "Next array";

Q. What is Recursive function in C#?
Ans. A function that call itself.

Q. Can a Abstract Class have a constructor?
Ans. Yes

Q. What will happen if a finally block throws and exception?
Ans. In calling method use try and catch to call a method.
Ex:
public void Method1()
{
try
{
Method2()
}

catch
{
}
}

public void Method2()
{
try
{
}
catch
{
}
finally
{
int i = Convert.ToInt32("Hello");
}
}

Q. What is the difference between int and Int32
Ans. Both are same, int is the short form that we use it in C# code.
But when creating enum Int32 is not allowed.



Comments

Popular posts from this blog

CAML Query in SharePoint 2010

Calling REST APi from server side code - C#

All about SharePoint 2010 Content Type Hub

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX