Thursday, January 3, 2008

Dot Net Interview Questions

Some example Questions :

1. Explain the differences between Server-side and Client-side code?
Server side code basically gets executed on the server (for example on a webserver) per request/call basis, while client side code gets executed and rendered on the client side (for example web browser as a platform) per response basis.

2. What type of code (server or client) is found in a Code-Behind class?
In the Code-behind class the server side code resides, and it generates the responses to the client appropriately while it gets called or requested.

3. What does the "EnableViewState" property do? Why would I want it on or off?
EnableViewState stores the current state of the page and the objects in it like text boxes, buttons, tables etc. So this helps not losing the state between the round trips between client and server. But this is a very expensive on browser. It delays rendering on the browser, so you should enable it only for the important fields/objects.

4. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers the currnet context of the page to the next page and also avoids double roundtrips. Where as Response.Redirect could only pass querystring and also requires roundtrip.

5. How does VB.NET/C# achieve polymorphism?
Polymorphism is achieved through virtual, overloaded, overridden methods in C# and VB.NET.

6. Whats an assembly
An assembly is the primary building block of .NET. It's a reusable, self-describing,versionable deployment unit for types and resources. They are self-describing so to allowthe .NET runtime to fully understand the application and enforce dependency and versioning rules.

7. What is other name for shared assembly?
Global Assembly

8. How do you create and use shared assemblies?
using GACUtil.exe

9. How do you use thread in your .NET application?
Derive your class from Thread Class

10. what are the main differences between Web Server controls and HTML Server controls?
HTML Server controls are the nothing but some html tags with runat=server attribute in that tag. Web Server controls have richer event handling. HTML Server Controls need to be nested within a form tag. and so on.

11. Differences between ref and out parameters?
out parameter need not be initialized, where as ref parameter needs to be. This clarifies that ref is both I/O parameter and out is only Output parameter as name suggests

12. When on the internet would you look for web services?
I guess the question is where on the Internet would you look for web services. Go to UDDI Server and find.

13. Does .NET supports Pessimistic record locking or Optimistic record locking or both?
both.

14. What is Catch API?
I am not aware of any Catch API. If it is Cache then look for Cache class and if it is exception handling (try catch throw block) look for it.

15. which method do you use to redirect the user to another page without performing a round trip to the client?
Server.Transfer

16. What base class do all web forms inherit from?
System.web.UI.Page class. But for UserControl its System.Web.UI.UserControl

17. what method do you use to explicitly kill a users session?
Session.Abandon

18. Which .NET class is used to validate an XML document?
XMLValidatingReader.

19. What is AutoPostBack
Use this property to specify whether the state of the control is posted back to the server when clicked, changes, list.

20. What is reflection
The process of obtaining information about assemblies and the types defined within them, and creating, invoking, and accessing type instances at run time.