Interview Tips Interview Tips, Interview Questions and Answers

9Mar/101

asp.net questions and answers

Whether azure supports all OS?
No it supports Windows 7, Vista, Windows 2008 server.

What is the difference between document.getElementById('<%= btnMakeUpdate.ClientID %>').name AND document.getElementById('<%= btnMakeUpdate.UniqueID %>')?
There is no difference. Both will use control's id seperated using $ sign.

MaintainScrollPositionOnPostback will work in Ajax Postback.
NOTE: This is objective type question, Please click question title for correct answer.

You are going to deploy a website on live server. Which build option you will select while building the website? 1. Debug 2. Release
You should select Release .

Your site is deployed on testing server and you make some change in web.config file stored on the server. What will happen to the user's who are accessing site at that time?
When you make any change in web.config file then IIS restarts automatically so all the session and application variables get reset. This can affect user drastically as their session is lost.

Can you add title to browser history point?
Yes, we can add.

Can you hash state information of URL ?
NOTE: This is objective type question, Please click question title for correct answer.

Can you have multiple form tags in a page?
YES.
Page can have multiple form tags but only one of them can contain runat=”server” atrribute at a time.

3Mar/100

C# interview questions and answers

I need to restrict a class by creating only one object throughout the application. How can I achieve this?
We can declare the constructor of the class as either protected or as private

int? d = 1; Type testType = d.GetType(); will result…
NOTE: This is objective type question, Please click question title for correct answer.

How can you make your machine shutdown from your program?
Process.Start("shutdown", "-s -f -t 0");

What is the use of unsafe keyword in C#?
In C# the value can be directly referenced to a variable, so there is no need of pointer. Use of pointer sometime crashes the application. But C# supports pointer, that means we can use pointer in C#.

The use of pointer in C# is defined as a unsafe code. So if we want to use pointer in C# the pointer must be present in the body of unsafe declaration. But pointer does not come under garbage collection.

Example:-

unsafe
{
int a, *b;
a = 25;
b = &a;
Console.WriteLine("b= {0}",b);//returns b= 25
}

What is difference between var and Dynamic ?
Var word was introduced with C#3.5(specifically for LINQ) while dynamic is introduced in C#4.0. variables declared with var keyword will get compiled and you can have all its related methods by intellisense while variables declared with dynamic keyword will never get compiled. All the exceptions related to dynamic type variables can only be caught at runtime.

What is dynamic keyword ?
Its newly introduced keyword of C#4.0. To indicate that all operations will be performed runtime.

What will happen if you declare a variable named "checked" with any data type?
Compiler will throw an error as checked is a keyword in C# So It cannot be used as variable name. Checked keyword is used to check the overflow arithmetic checking.

What are anonymous methods?
Anonymous methods are another way to declare delegates with inline code except named methods.

Restrictions of yield in try-catch.
While using yield keyword, mainly two restrictions are observed.
First is , we can’t use yield in finally.
Second is , we can’t place yield keyword in the catch block if try contains more than one catch blocks.

With yield break statement, control gets …
NOTE: This is objective type question, Please click question title for correct answer.

What first action compiler will take on detection of iterator ?
As soon as compiler will detect iterator, it will automatically generate current, MoveNext and Disposemethods of the IEnumerator or IEnumerator(T) type.