Monday, February 28, 2011

C# Interview questions:- What role did your play in your current project?

C# Interview questions:- What role did your play in your current project?



Answer:
This is again a great c# interview question , but .NET professionals tend to answer this
question in one liners like i am a developer , project manager.

In todays world people expect professionals who can do multitasking. The best way to approach the answer is by explaining what things did you do in the complete SDLC cycle. Below goes my version of the answer , you can tailor the same as per your needs.
My main role in the project was coding , unit testing and bug fixing. Said and done that i was involved in all phases of the project.

I worked with the business analyst in the requirement phase to gather requirements and was a active member in writing use cases.

I also assisted the technical architect in design phase. In design phase i helped the architect in proof of concept and putting down the technical design document.

My main role was in coding phase where i executed project with proper unit testing.

In system integration test and UAT i was actively involved in bug fixing.
Other than the project i help COE team for any kind of RND and POC work.
In case you are doing some extra activities in the company like helping COE , presales team or any other initiative do speak about the same.

Watch my 50 C# interview questions and answers

ASP.NET Interview question :- What are HttpHandler and HttpModules and how do they differ?

ASP.NET Interview question :- What are HttpHandler and HttpModules and how
do they differ?


Answer:

Both the above concepts are rarely used by developers but mostly asked
in .NET interviews .

The prime and common goal of HttpHandler and httpModule is to inject pre-processing logic before the ASP.NET request reaches the IIS server.

HttpHandler is a extension based processor in other words pre-processing logic is executed depending on file extensions. For instance sometimes you would like to check that a person should be above age of 18 if he is trying to view any files with extension *.MP4.

HttpModule is event based processor. ASP.NET engine emits out lot of events as the request traverses over the request pipeline. Just to name some events beginrequest ,authorizerequest,authenticaterequest etc. By using HttpModule you can write logic in these events. These logic get executed as the events fire and before the request reaches IIS server.

So a short answer for the above.NET interview question would be HttpHandler is a extension based processor while HttpModule is a event base processor. Both of them help to inject pre-processing logic before the ASP.NET request reaches the IIS server.
See my Top ASP.NET Interview questions and answers

Saturday, February 26, 2011

ASP.NET interview question :- How do we write a HttpModule ?

ASP.NET interview question :- How do we write a HttpModule ?



Answer:

Again a simple .NET Interview question Writing a HttpModule is a two step process.
Create a class which implements IhttpModule.

  public class clsHttpModule : IHttpModule
 {

 public void Init(HttpApplication context)
 {
    this.httpApp = context;
    httpApp.Context.Response.Clear();
    httpApp.AuthenticateRequest += new EventHandler(OnAuthentication);
    httpApp.AuthorizeRequest += new EventHandler(OnAuthorization);
 ....
 ....
 ....

 }
 void OnAuthorization(object sender, EventArgs a)
 {
     //Implementation
 }
 void OnAuthentication(object sender, EventArgs a)
 {   
     //Implementation
 }
 }

Make a entry in the web.config file.

  <httpModules>
<add name="clsHttpModule" type="clsHttpModule"/>
</httpModules>

Do view my top .NET interview questions and answers

ASP.NET Interview question :- How do we write a HttpHandler ?

ASP.NET Interview question :- How do we write a HttpHandler ?


Answer:
This is a simple a .NET Interview question .Its a two step process.

First create a class which implements Ihttphandler
public class clsHttpHandler : IHttpHandler
{
   public bool IsReusable
   {
       get { return true; }
   }
   public void ProcessRequest(HttpContext context)
   {
      // Put implementation here.
   }
}

Step 2 make a entry in the web.config file.

<httpHandlers>
<add verb="*" path="*.gif" type="clsHttpHandler"/>
</httpHandlers>

You can view my top ASP.NET Interview questions and answers

Friday, February 25, 2011

ASP.NET interview question:-What is the difference between render and prender event ?

ASP.NET interview question:-What is the difference between render and prender event ?


Answer:
This is again a very nice .NET interview question and the question can be confusing because of the common word "render". Now ASP.NET page has 4 important events. Init , Load , validate ,
event and render (Remember SILVER).

Now the final render is a actually a two step process.
1- First the ASP.NET UI objects are saved in to view state.
2- loaded viewstate is assembled to create the final HTML.
The first step is pre-render event and the second step is the render event.

Prerender
This is the event in which the objects will be saved to viewstate.This makes the PreRender event the right place for changing properties of controls or changing Control structure.Once the PreRender phase is done those changes to objects are locked in and the viewstate can not be changed. The PreRender step can be overridden using OnPreRender event.

Render.
Render event assembles the HTML so that it can be sent to the browser.In Render event developers can write custom HTML and override any HTML which is created till now.The Render method takes an HtmlTextWriter object as a parameter and uses that to output HTML to be streamed to the browser. Changes can still be made at this point, but they are reflected to the client only i.e. the end browser.

View my top .NET Interview question and answers

.NET interview question on generics :- How does performance increase by using generic collection ?

.NET interview question on generics :- How does performance increase by using generic collection ?


Answer:
When we use normally .NET collection objects there is lot of boxing and unboxing. When we create a collection which is a generic collection its strongly typed. As its strongly typed boxing and unboxing gets eliminated and thus increasing performance.
See my 32 important C# interview questions

Wednesday, February 23, 2011

.NET Interview Questions:-What is the sequence in which ASP.NET page life cycle is executed ?

.NET Interview Questions:-What is
the sequence in which ASP.NET page life cycle is executed ?



Answer:
This is a great and the most asked ASP.NET interview question. Out of 100 .NET interviews atleast 70 interviewer will ask this question. The answer is very simple but the problem with the answer is that developers forget the sequence of ASP.NET page life cycle.

The best way to remember this answer is by remembering the word SILVER.
S (Well this word is just to make up the word , you can just skip this.)
I (Init)
L (Load)
V (Validate)
E (Event)
R (Render)

Please see my 22 top .NET Interview questions and answers