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. 

Friday, March 2, 2012

Website vs Web service

The basic difference of a website vs a web service is that:

Website/Web application: Returns a slew of web pages served by a web server (e.g. IIS) that are human readable via a browser. 

Web Service: Returns data in various formats (xml, json, etc), depending on the protocol (SOAP, HTTP,etc) that is machine understandable, usually for other applications to use that data. If you want to have that data human-readable then a web page that consumes that data, has to be built which is then rendered by the browser. 

Programmers - web service returns pure objects whereas web site renders data in web pages which can be rendered by the browser.