Monday, March 12, 2012

(Tricky) C#.NET, SQL Server interview questions

1. What is the difference between classic ASP and ASP.NET ?
(my answer) ASP.NET has the .NET framework part which includes CLS and CLR. CLS - has all the libraries. CLR provides the ability to convert MSIL to binary code and take care of bunch of other stuff like Garbage collection, etc.

2. Principles of OOPS.
Inheritance, Polymorphism, Abstraction, Encapsulation.

3. What is the need of Encapsulation?

4. Is C# Array type a value type or reference type. - It is a REFERENCE type.

5. Is C# string a reference type or a value type - It is a REFERENCE type.

6. If a stored procedure has a variable defined as varchar(10) but hasn't been initialized. Then what would be the value of LEN(variable)? - It will be NULL.

7. If there is a nested Transaction in sql stored procedure and the inner Transaction rolls back, what will happen at the commit of the outer Transaction?

8. How to do authentication with Windows Authentication for a website? If there are 100 users how you would you authenticate their access permissions?

9. Difference between a session and view state
- Session is global whereas view state is for the particular aspx page.
- View state is sent back to client (browser) every time in an encrypted hidden variable but the value of session variable is passed in as a cookie or appended to the URL.

10. How to implement caching?

11. Would you choose JSON or XML for web service return format?
JSON - because it is light weight compared to XML.

12. Is WSDL alone enough to connect to an open source (not .NET) web service?

13. Heap vs Stack allocation of memory in .NET. 

1 comment:

Anonymous said...

Nice questions, but I tend to prefer C# and SQL interview questions which focus more on practical coding experience rather than 'theory'. For instance:

http://cc.davelozinski.com/general/tricky-csharp-and-sql-interview-questions

My reasoning is anyone can memorize theory and basics, but the tricks from coding only come through actual experience. :-)