Tuesday, October 12, 2010

Frequently Asked Interview Question-Answer of ASP.NET

What property is use to set alternate color scheme in a Repeater control?
         AlternatingItemTemplate.

What is the base class for Web Forms?
         The System.Web.UI.Page class.

What are the meaning of terms boxing and un-boxing?
         Boxing: Implicit conversion of a value type into a reference type. Un-Boxing: Explicit conversion of a reference type into a value type. Can also be call casting.

Give a brief description of how the heap and stack are managed in .Net.
         Stack and heap are memory sections of the .net application. The CLR(Common Language Runtime) is in charge of managing those sections. Value type variables are stored in the stack where storing order is Last in first out. When a variable is out of scope it basically fall off the stack. Refence type variable are stored on the heap where storing order is First in first out. When a variable becomes out of scope it is mark for collection. The GC(Garbage Collector) is the part of the CLR responsible for cleaning up the heap releasing resources occupied by Reference type variables.

What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
         SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it is a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

How is the DLL Hell problem solved in .NET?
         Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

What are the ways to deploy an assembly?
         An MSI installer, a CAB archive, and XCOPY command.

What is the difference between // comments, /* */ comments and /// comments?
         Single-line, multi-line and XML documentation comments.

How do you debug an ASP.NET Web application?
         Attach the aspnet_wp.exe process to the DbgClr debugger.

What is smart navigation?
         The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.


What is De-normalization?
         De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.

How to manage pagination in a page?
         Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.

Can the validation be done in the server side? Or this can be done only in the Client side?
         Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.

Explain the differences between Server-side and Client-side code?
         Server side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesnt have some of the functionality like sockets, uploading, etc. For these you have to make a custom components usually in VB or VC++. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript. Download time, browser compatibility, and visible code - since JavaScript and VBScript code is included in the HTML page, then anyone can see the code by viewing the page source. Also a possible security hazards for the client computer.

What is the transport protocol you use to call a Web service?
         SOAP is not the transport protocol. SOAP is the data encapsulation protocol that is used but the transport protocol is fairly unlimited. Generally HTTP is the most common transport protocol used though you could conceivanly use things like SMTP or any others. SOAP is not dependant on any single transport protocol or OS, it is a syntactical and logical definition, not a transport protocol.

What does WSDL stand for?
         Web Services Description Language

What tags do you need to add within the asp:datagrid tags to bind columns manually?
         Column tag and an ASP:databound tag.

Which control would you use if you needed to make sure the values in two different controls matched?
         Use the CompareValidator control to compare the values of 2 different controls.

How many classes can a single .NET DLL contain?
         Unlimited.

What are the properties and different Types of Sub-Queries?
         Properties of Sub-Query A sub-query must be enclosed in the parenthesis. A sub-query must be put in the right hand of the comparison operator, and A sub-query cannot contain an ORDER-BY clause. A query can contain more than one sub-query. Types of Sub-query Single-row sub-query, where the sub-query returns only one row. Multiple-row sub-query, where the sub-query returns multiple rows,. and Multiple column sub-query, where the sub-query returns multiple columns
What are the objects in asp.net and tell the purpose of those objects?
         Here are 5 objects in asp.net

1.Response:This object is to response to other e.g.:

2.Request:This object is request from server

3.Application: This object is store global information of application.

4.Session:This object used store the values into variable.

5.Server:






What tag do you use to add a hyperlink column to the DataGrid?
         <asp:HyperLinkColumn> 

Explain the ways of authentication techniques in ASP.NET
         Selection of an authentication provider is done through the entries in the web.config file for an application.
The modes of authentication are:
<authentication mode=”windows”>
<authentication mode=”passport”>
<authentication mode=”forms”>
Custom authentication needs installation of ISAPI filter in IIS. It compares incoming requests to a list of source IP addresses and a request is considered to be authenticated if it comes from an acceptable address.


What is AppSetting Section in “Web.Config” file?
         Web.config file defines configuration for a webproject.
AppSetting section is used to set the user defined values. For e.g.: The ConnectionString which is used through out the project for database connection.
<configuration>
<appSettings><BR><addkey="ConnectionString"value="server=xyz;pwd=www;database=testing" />
</appSettings>


Can a .NET web application consume Java web service ?
         Yes.Actually Webservices are independent to language. it depends on WSDL and SOAP. so any one can develope the Webservices anddisclose the wsdl and users can cosume the webservices.wsdl and soap both are xml based.. and all languages having xml parsing capability and access to http protocol will be able to work with Webservices

how to click or select a row in gridview using c# code?
         We should use the Currency CurrencyManager cmGrid = (CurrencyManager)this.BindingContext[gridview.DataSource, gridview.DataMember]; cmGrid.Position = iIndex;

What is IPostBack? How to use it?
         Ispostback event is generated by the web controls to alert the server to take respected action of the event generated. When the button is clicked then click event is generated which further cause ispostback event & it alerts the server to take respected action during postback event.

ColumnMapping belongs to which namespaces?
         ColumnMapping belongs to System.Data

Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component
         when there is no .Net framework installed in one of the communicating applications

Enumerate the types of Directives?
        
  • @ Page directive
  • @ Assembly directive
  • @ Import directive
  • @ Reference directive
  • @ Implements directive
  • @ OutputCache directive
  • @ Register directive
Which method do you invoke on the DataAdapter control to load your generated dataset with data?
        
  • dataadapter.fill(dataset object)


In order to get assembly info whcih namespace we should import?
         system.reflection

Differnce B/w DataReader and DataSet
         The Dataset is an core of disconnected architecture.Disconnected architecture means once you have retriveed the data from the database the connect of the datasource is dropped.The disconnected data become very commonlyThe dataset for the disconnected data from the Dataset object.The DataReader is an readonly ,forward only stream from the database.While using the datareader can improve the application performance reduce the system overhead because only one buffer row at a time in memory.


Explain the ASP.NET page lifecycle.
        
  • Page_Init(Initialization of the page)
  • LoadViewState(loading of View State)
  • LoadPostData(Postback data processing) 
  • Page_Load(Loading of page) 
  • RaisePostDataChangedEvent(PostBack change notification)
  • RaisePostBackEvent (PostBack event handling) 
  • Page_PreRender (Page Pre Rendering Phase) 
  • SaveViewState (View state saving) 
  • Page_Render (Page rendering)
  • Page_UnLoad (Page unloading)


ASP.NET application life cycle and events processing-
         A web application starts when a browser requests a page of the application first time. The request is received by the IIS which then starts ASP.NET worker process (aspnet_wp.exe). The worker process then allocates a process space to the assembly and loads it. An application_start event occurs followed by Session_start. The request is then processed by the ASP.NET engine and sends back response in the form of HTML. The user receives the response in the form of page. 

The page can be submitted to the server for further processing. The page submitting triggers postback event that causes the browser to send the page data, also called as view state to the server. When server receives view state, it creates new instance of the web form. The data is then restored from the view state to the control of the web form in Page_Init event.
The data in the control is then available in the Page_load event of the web form. The cached event is then handled and finally the event that caused the postback is processed. The web form is then destroyed. When the user stops using the application, Session_end event occurs and session ends. The default session time is 20 minutes. The application ends when no user accessing the application and this triggers Application_End event. Finally all the resources of the application are reclaimed by the Garbage collector.

No comments:

Post a Comment

Confidence may not bring success but
It gives a heart to face any challange..!