Find here Interview Questions for .Net
Below questions have been asked in one of the interview that was faced recently.
1-Boxing and unboxing
2-Partial class,what are advantages
4-Master page and nested master pages
6-Interface and Abstract class,diffence between them
7-Impelemtation of Interface and abstract class in ado.net
9-How to run a server side function when browser is closed
10-Page life cycle
11-what is initializtion in page life cycle rendering
12-Asp.net Session state
13-When themes is assigned in page life cycle
14-Inproc and outproc session management
16-What are client activated objects and server activated objects?
17-Which template must you provide, in order to display data in a Repeater control?
18-What method do you use to explicitly kill a user s session?
19-How would you implement inheritance using VB.NET/C#?
Different design pattern
Transaction in database
Disdvantage of triggers
Functional and Transational dependencies
Boxing and unboxing:
boxing: it converts value type into reference type
where as unboxing : it converts reference type into value type
it takes more memory in cpu to convert one data type into another datatype.
Partial class and advantages:
Partial class is a keyword which is used to split the definition of the class into multiple parts with same singature.
When compiler compiles the class file ,it makes into single file
page directives :
@previous page type
rfer msdn link
I just try to provide answers based on my experience.
1) Boxing and unboxing
A) Boxing- Convert value type to reference type is called as Boxing
UnBoxing – Convert Reference Type to value type is called as UnBoxing.
5) Sealed class
A) To prevent Override the methods and properties from base class to derived class using Sealed class. By default every class is sealed class only. But using Abstract and Virtual keywords we can able to override base class properties.
6) Interface and Abstract class,diffence between them
A) Interfaces – C#, doesn't supports multiple inheritance using interface class we can able to inherit multiple classes.
Abstract – In base class we declare the method as Abstract keyword and it is optional to implement that in base class. But that is mandatory to implement that in derived classes.
You want to know the difference between those 2 then refer below link.
10) Page life cycle
A) • InIt:
Before constructing the control PreInIt then each control Instantiated set to Innitial state Added to Control State.
Lost state of the controls restored from viewstate values.
User Code runs, tests it's postback conditions to databind first value.
• PostBack Data:
Posted Data is passed to its associated controls.
• PostBack Events:
Events are fixed for controls in tree order, except the event that caused the post it's fired last.
• Pre Render:
Creat Child Controls, ensure contros are ready to render.
• Save ViewState:
Controls save current state (if different than innitital values)
Each control Render itself to the Response.
Page and all controls are destroyed.
12) Asp.net Session state
A) Web is stateless because of HTTP, to overcome the above drawbacks ASP.net introduces few concepts to maintain status of controls. In that one of the concept is Session, using session we can maintain state for multiple pages but using viewstate we can't maintain state for multiple pages. Session data will store in Server side. That means it's store in system memory. There are 2 types to store the session data one is In-Process and another one is out-Process. Drawbacks to use session object is if data is heavy then performance also decreases due to fetch from Server machine.
17) Which template must you provide, in order to display data in a Repeater control?
A) HeaderTemplate – is used to display the header Text.
ItemTemplate – is used to display the Item data.
18) What method do you use to explicitly kill a user s session?