Thursday, May 09, 2013

.NET Interview Questions and Answers

Posted by Rahul Kharde at 11:03 PM

What is the difference between Server.Transfer and response.Redirect?
In Server.Transfer page processing transfers from one page to the other page without making a round-trip back to the client’s browser. This provides a faster response with a little less overhead on the server. The clients url history list or current url Server does not update in case of Server.Transfer.

Response.Redirect is used to redirect the user’s browser to another page or site. It performs trip back to the client where the client’s browser is redirected to the new page. The user’s browser history list is updated to reflect the new address.

What’s the use of Response.Output.Write()?
We can write formatted output using Response.Output.Write().

From which base class all Web Forms are inherited?
Page class.

What is the differences between Server-side and Client-side code?
Server-side code executes on the server.
Client-side code executes in the client’s browser.

What is the differences between dataset.clone and dataset.copy?
Dataset.clone - Copies just the structure of dataset.It doesn’t copy the data.
Dataset.copy - Copies both the dataset structure and the data.

How can we identify that the Page is Post Back?
Page object has an "IsPostBack" property, which can be checked to know that is the page posted back.

Where the viewstate is stored after the page postback?
ViewState is stored in a hidden field on the page at client side. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.

How long the items in ViewState exists?
They exist for the life of the current page.

What is the difference between early binding and late binding?
Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

What is “AutoPostBack”?
If we want the control to automatically post back in case of any event, we will need to check this attribute as true. Example on a Combo Box change we need to send the event immediately to the server side then set the “AutoPostBack” attribute to true.

What is the lifespan for items stored in the ViewState?
The items stored in ViewState live until the lifetime of the current page expires including postbacks to same page.

What is the difference between  “Web.config” and “Machine.Config”?
“Web.config” files apply settings to each web application, while “Machine.config” file apply settings to all ASP.NET applications.
View state is client-side or server side state management technique?
View state is client-side state management technique

What is a PostBack?
The process in which a Web page sends data back to the same page on the server

What is the use of “GLOBAL.ASAX” file?
It allows to execute ASP.NET application level events and setting application-level variables.

What are design patterns?
Design patterns are common solutions to common design problems

How do you enable or disable a ViewState at the page level?
At the page level you can enable or disable ViewState using EnableViewState property of the page.

If I write System.exit (0); at the end of the try block, will the finally block still execute?
No in this case the finally block will not execute because when you say system.exit(0),the control immediately goes out of the program, and thus finally never executes.

What are the different types of indexes?
Two types of indexes are there one is clustered index and non-clustered index

What is the name of the hidden form field in which ViewState of the page is saved?
__ViewState

Is it possible to set the session out time manually?
Yes we can set the session out time manually in web.config.
More info Click here..
Is ViewState of one page available to another page?
No, ViewState of a Page is available only in that page. You cannot access ViewState of one page from another page.

What is a SESSION and APPLICATION object?
Session object store information between HTTP requests for a particular user, while application object are global across users.

What is boxing and unboxing concepts in .net?
Boxing is a process of converting value type into reference type
Unboxing is a process of converting reference type to value type.

What are the different validators in ASP.NET?
 - Required field Validator
- Range Validator
- Compare Validator
- Custom Validator
- Regular expression Validator
- Summary Validator

What is Protected Configuration?
It is a feature used to secure connection string information.

What is view state?
The web is stateless.The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control
Can you use multiple inheritance in .NET?
.NET supports only single inheritance. However the purpose is accomplished using multiple interfaces.

What is difference between ExecuteReader, ExecuteNonQuery and ExecuteScalar?
ExecuteReader : Use for accessing data. It provides a forward-only, read-only, connected recordset.
ExecuteNonQuery : Use for data manipulation, such as Insert, Update, Delete.
ExecuteScalar : Use for retrieving 1 row 1 col. value., i.e. Single value. eg: for retrieving aggregate function. It is faster than other ways of retrieving a single value from DB.




If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!


Kindly Bookmark and Share it:

YOUR ADSENSE CODE GOES HERE

0 comments:

Have any question? Feel Free To Post Below:

 

Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top