Asp interview questions

Q 1: What is the difference between web.config and machine.config ?
Answer:  The settings made in the web.config file are applied to that particular web application only whereas the settings of machine.config file are applied to the whole asp.net applications configured on that server.

Q 2: What are the different types of sessions in ASP.Net? Name them.

Answer:  Session Management can be achieved in two ways:
1)InProc
2)OutProc  (again two types State Server and SQL Server)

InProc
Advantage:
1) Faster as session resides in the same process as the application
2) No need to serialize the data
Disadvantage:
1) Will degrade the performance of the application if large chunk of data is stored
2) On restart of IIS all the Session info will be lost
State Server
Advantage:
1) Faster than SQL Server session management
2) Safer than InProc. As IIS restart
won't effect the session data
Disadvantage:
1) Data need to be serialized
2) On restart of ASP.NET State Service session info will be lost
3)Slower as compared to InProc
SQL Server
Advantage:
1) Reliable and Durable
2) IIS and ASP.NET State Service
restart won't effect the session data
3) Good place for storing large chunk of data
Disadvantage:
1) Data need to be serialized
2) Slower as compare to InProc and State Server
3)Need to purchase Licensed
version of SQL Server
Q 3: What is the difference between autopostback and ispostback?
Answer:
Autopostback - Property of the control
IsPostback - Property of the Page class
Autopostback - get and set property to control postback on changes made for control.
for e.g.
this.ListBox1.AutoPostBack = true;
whenever user will select item, the page will get post back.
IsPostback - get property of the Page class, to check if page is post back i.e. if it is true then page has already executed Init function of the page else it is first time the page has requested to be executed.

Q 4: State the difference between a Session and an Application

Answer:  Basically, in session state It allows you to store any type of data in memory on the server. The information is protected, because it is never transmitted to the client, and uniquely bound to a specific session. Every client that accesses the application has a different session and a distinct collection of information. Instance of every user is different which is differentiated by a session ID.
While in case of an application state, it allows you to store global objects that can be accessed by any client. That is the instance for every user is same.

Q 5: what is boxing and unboxing?

Answer:
Boxing is what happens when a value-type object is assigned to a reference-type variable.
Unboxing is what happens when a reference-type variable is assigned to a value-type variable.

Q 6: what is Reflection?

Answer: Reflection is a collection of classes which allow you to query assembly (classes/objects) metadata at runtime. Using reflection you can also create new types and their instances at runtime and invoke methods on these new type instances.
There are other uses for reflection. Compilers for languages such as JScript use reflection to construct symbol tables.
In .Net the classes in the System.Runtime.Serialization namespace use reflection to access data and to determine which fields to persist. You can use System.Reflection.Emit namespace to dynamically generate types.



Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment