Tuesday, October 12, 2010

Frequently Asked Interview Question-Answer of ASP.NET

What is Fragment Caching in ASP.NET?
         Fragment caching allows to cache specific portions of the page rather than the whole page. It is done by implementing the page in different parts............

What is partial classess in .net?
         When there is a need to keep the business logic separate from the User Interface or when there is some class which is big enough to have multiple number of developers............

What is a ViewState?
         If a site happens to not maintain a ViewState, then if a user has entered some information in a large form with many input fields and the page is refreshes, then the values filled up in the form are lost

What is the difference between src and Code-Behind?
         With the ‘src’ attribute, the source code files are deployed and are compiled by the JIT as needed. Though the code is available to everyone with an access to the server (NOT anyone on the web)

What is the Pre-Compilation feature of ASP.NET 2.0
         Previously, in ASP.NET, the pages and the code used to be compiled dynamically and then cached so as to make the requests to access the page extremely efficient

How can we create custom controls in ASP.NET
         Custom controls are user defined controls. They can be created by grouping existing controls, by deriving the control from System.Web.UI.WebControls..........

What is the difference between cookies and session? and Where we will use sessions in real time project?
         Both cookies and session are used to hold a value..but both are different because cookies is used to stored client information in client side and session is used to provide uniqueness to client request.in real time session variable is use to move data from one page to other page.and session is use for server side state management.

What’s the difference between Response.Write() andResponse.Output.Write()?
         Response.Output.Write() allows you to write formatted output.

What methods are fired during the page load?
         Init() - when the page is instantiated Load() - when the page is loaded into server memory PreRender() - the brief moment before the page is displayed to the user as HTML Unload() - when page finishes loading.

When during the page processing cycle is ViewState available?
         After the Init() and before the Page_Load(), or OnLoad() for a control.
What does the "EnableViewState" property do? Why would I want it on or off?
         It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

What are the different types of Session state management options available with ASP.NET?
         ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
         Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the clients browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the users browser to another page or site. This performas a trip back to the client where the clients browser is redirected to the new page. The users browser history list is updated to reflect the new address

Whats an assembly?
         Assemblies are the building blocks of the .NET framework.

What is MSIL, and why should my developers need an appreciation of it if at all?
         MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

What is the difference between DataList and Repeater data binding controls?
         The DataList control is similar to the Repeater control. However, it has some additional properties and templates that you can use to display its data in a diverse fashion. The Repeater control does not have any built-in layout or style. We are forced to specify all formatting-related HTML elements and style tags. On the other hand, a DataList control provides more flexibility to display data in a desired layout. It also provides data selection and editing capabilities. How does it do it? Well, in addition to the five templates (Item Template, AlternatingItem Template, Separator Template, Header Template, Footer Template that a repeater has, the DataList control has two more templates: SelectedItemTemplate, and EditItemTemplate. These templates are useful for allowing data selection and data editing functionalities. Furthermore, the RepeatDirection and RepeatColumns properties of a DataList control can be exploited to lay out the data in horizontal or vertical fashions.

How many languages .NET is supporting
         When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported by .NET

How is .NET able to support multiple languages?
         A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.

What is ADO .NET and what is difference between ADO and ADO.NET?
         ADO uses Recordsets and cursors to access and modify data. Because of its inherent design, Recordset can impact performance on the server side by tying up valuable resources. In addition, COM marshalling - an expensive data conversion process - is needed to transmit a Recordset. ADO.NET addresses three important needs that ADO does not address. 1. Providing a comprehensive disconnected data-access model, which is crucial to the Web environment 2. Providing tight integration with XML, and 3. Providing seamless integration with the .NET Framework (e.g., compatibility with the base class librarys type system). From an ADO.NET implementation perspective, the Recordset object in ADO is eliminated in the .NET architecture. In its place, ADO.NET has several dedicated objects led by the DataSet object and including the DataAdapter, and DataReader objects to perform specific tasks. In addition, ADO.NET DataSets operate in disconnected state whereas the ADO RecordSet objects operated in a fully connected state. In ADO, the in-memory representation of data is the recordset. In ADO.NET, it is the dataset. A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table. In contrast, a dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database. In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method. In ADO.NET, rows are represented as collections, so you can loop through a table as you would through any collection, or access particular rows via ordinal or primary key index. A cursor is a database element that controls record navigation, the ability to update data, and the visibility of changes made to the database by other users. ADO.NET does not have an inherent cursor object, but instead includes data classes that provide the functionality of a traditional cursor. For example, the functionality of a forward-only, read-only cursor is available in the ADO.NET DataReader object. There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source.

List all Validation Controls available in asp .net?
         RequiredFieldValidator : Checks if a control has a value. RangeValidator : Checks if the control’s value is within a certain range. RegularExpressionValidator : Checks whether the value of an input control matches a certain pattern CompareValidator : Checks a control’s value against a constant or another control value. CustomValidator : Checks a control’s value against a customized validation logic. ValidationSummary : Displays a list of all validation errors
  
 

No comments:

Post a Comment

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