Tuesday, February 2, 2010

Asp.Net interview questions and answers-PART.1

Question - What is the lifespan for items stored in ViewState?
Answer - 
Items stored in the ViewState exist for the life of the current page.
This includes postbacks (to the same page).

Question - Define EnableViewState property.
Answer
- 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.

Question - What are Delegates?
Answer - 
Delegates provide the functionality behind events.
A delegate is a strongly typed function pointer.
Invoke a method without making an explicit call to that method.
In Visual Basic .NET, the role of the delegate is largely behind the scenes

Question - What are Classes?
Answer - Classes are the blueprints for objects.
A class acts as a template for any number of distinct objects.

Question - What is Encapsulation?
Answer
- The data of an object should never be made available to other objects.

Question - Different types of Session state management options available with ASP.NET?
Answer - 
ASP.NET provides In-Process and Out-of-Process state management.
In-Process stores the session in memory on the 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.


Question - What methods are fired during the page load? 
Answer - 
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
. 

Question - Explain ADO.NET.
Answer - It is data-access technology, primarily disconnected and designed to provide efficient, scalable data  access.
The disconnected data is represented within a DataSet object.
A data provider is a set of classes that provide access to databases. The main components of data provider are:
Connection
Command
DataReader
DataAdapter

Visual Studio .NET includes two data providers:
SQL Data Provider
OleDb Data Provider

Two additional data providers are included in Visual Studio .NET 2003:
ODBC Data Provider
Oracle Data Provider

Question - Define Server-side and Client-side code in ASP.NET.
Answer - 
Server-side code runs on the server.
Client-side code runs on the client's browser.
Question - Where does VS.NET store Web application projects?
Answer - Web application projects create a virtual folder for each project where all the files of the projects are stored. The virtual folder can be viewed in IIS and property of that folder determines where the files are physically stored.

Question - Describe Web application’s life cycle.
Answer - A Web application starts with the first request for a resource.
On request, Web forms are instantiated and processed in the server.
Server sends its response to the client.
Application ends once all client sessions end
.

Question - Steps to execute a stored procedure from Web Application.
Answer - Create a command object.
Set the object’s CommandText property to the name of the stored procedure.
Set the CommandType property to stored Procedure.
Execute stored procedure using command object’s method.

Question - Describe exception handling in ASP.NET.
Answer - Exception handling correct unusual occurrences and prevent application from getting terminated. You can use Try(try) block and Error event procedures to handle exceptions.

Question - What are the exception-handling ways in ASP.NET?
Answer - Exceptions can be handled by using Try(try) block and Error event procedures at the global, application, or page levels by using the Server object’s GetLastError and ClearError methods.

Question - Describe use of error pages in ASP.NET. 
Answer - Error pages are used when exceptions are outside the scope of the application and the application can’t respond directly to these exceptions. These types of exceptions are identified by HTTP response codes, which IIS can respond to by displaying custom error pages listed in your application’s Web.config file.
Question - Explain tracing in ASP.NET.
Answer - Tracing records unusual events while an application is running. It helps in observing problems during testing and after deployment. An application can write a message in case of unusual events to the trace log using Trace class.
Question - What is the use of ComVisible attribute?
Answer - ComVisible attribute is used to select which public .NET classes and members are visible to COM.

Question - Define Windows and Forms authentication.
Answer - Windows authentication is the default authentication method of the ASP.NET application. It uses security scheme of windows operating system of corporate network. Windows authentication uses user names, passwords, and permissions of network resources and Web applications. User lists for Windows authentication are included in the element of Web.config.
Form authentication allows creating own database of users in the application’s Web.config file or in a separate user database and validate the identity of the users when they visit Web site. Users do not have to be member of a domain-based network to have access to your application.

Question - What is Secure Sockets Layer (SSL) security?
Answer - SSL protects data exchanged between a client and an ASP.NET application by encrypting the data before it is sent across the internet.

Question - Why is the Machine.config file?
Answer - The Machine.config file controls issue like process recycling, number of request queue limits, and what interval to check if user is connected.

Question - Explain how to distribute shared components as part of an installation program?
Answer - Shared components should be included as a merge module within the setup project. Merge modules can’t be installed by themselves. They can be installed only as part of an application installation.

Question - Define Unit testing, Integration testing, Regression testing.
Answer - Unit testing ensures that each piece of code works correctly.
Integration testing ensures each module work together without errors.
Regression test ensures new code did not break previously working code.

Question - Define HTML and XML. 
Answer - HTML: It has predefined elements names '


0 Comments: