Tuesday, July 1, 2008

ASP Interview Questions And Answers

ASP Interview Questions And Answers

The Control class belongs to which namespace?

1. System.Web.UI
2. System.Web.UI.WebControls
3. System.Web
4. System
Correct Answer: -> 1

Feedback: -> That’s correct. The Control class is the base class for all the server controls that are used for building the user interface. It resides in the System.Web.UI namespace, which contains the base classes used to build the user interface of an ASP.NET page.

Which of the following state management options can be used to automatically save the value of each control before rendering the page?

1. The ViewState property
2. Hidden fields
3. Cookies
4. Query strings

Your Answer: -> 1

Feedback: -> That’s correct. Each Web Form page and the controls on the page have the ViewState property that is inherited from the base Control class. The ASP.NET framework uses the ViewState property to automatically save control-specific and page-specific values.

Which class supports page-level tracing in an ASP.NET application?
1. TraceContext
2. Trace
3. HttpHandlerConfigHandler
4. HttpModulesConfigHandler
Your Answer: -> 1
Feedback: -> That’s correct. The TraceContext class supports the trace functionality for ASP.NET pages.

Which attribute of the forms element is used in the Web.Config file to specify the page to which a user request is to be redirected for logon?
1. name
2. loginUrl
3. protection
4. timeout
Correct Answer: -> 2
Feedback: -> That’s correct. The loginUrl attribute of the forms element is used to specify the page to which the user request is to be redirected for logon when no valid authentication cookie is found.

Which of the following objects is used to store and retrieve information that can be shared among all the users of an application?
1. Request
2.. Application
3. Response
4. Server
Correct Answer: -> 2
Feedback: -> That’s correct. The Application object is used to store and retrieve the information that can be shared among all the users of an application. For example, you can use an Application object to create a chat page.

You have created the login.aspx Web Form for accepting the user name and password. To successfully log on, a user must specify “appuser” as the user name and “paradise” as the password. Which of the following statements will you use in the Web.Config file to be able to perform the specified task?


1.







2.







3.





4.






Correct Answer: -> 2

Feedback: -> That’s incorrect. Web.Config is an XML-based file. Therefore, it must conform to the rules for well-formed XML documents. In the code, the tags are not closed properly. Therefore, the code will result in an error.

Which of the following attributes of the trace element is used to specify whether or not trace information will be displayed for each Web Form?
1. enabled
2. requestLimit
3. pageOutput
4. traceMode
Correct Answer: -> 3

Feedback: -> That’s incorrect. The enabled attribute is used to enable the trace feature for an ASP.NET application.


Which of the following is the correct definition of impersonation?

1. Impersonation refers to the process of verifying whether a user has permissions to access an application.
2. Impersonation refers to the process of restricting the access of an authenticated user to parts of the application or Web site for which a user is already authenticated.
3. Impersonation refers to an ASP.NET application using the identity of a client.
4. Impersonation refers to the practice of providing content and other facilities, such as the background color of the Web Form, to users based on their preferences.

Correct Answer: -> 3
Feedback: -> That’s incorrect. Authentication refers to the process of verifying whether a user has permissions to access an application.

Which of the following templates refers to the collection of elements and controls that are rendered once for each row in a data source?

1. SelectedItemTemplate
2. ItemTemplate
3. EditItemTemplate
4. AlternatingItemTemplate

Correct Answer: -> 2
Feedback: -> That’s incorrect. SelectedItemTemplate refers to the collection of elements and controls that are rendered when an item is selected in the server control.

Which of the following elements in the Web.Config file allows you to specify the custom settings for a Web application?

1. configSections
2. appSettings
3. customErrors
4. trace

Correct Answer: -> 2
Feedback: -> That’s correct. The appSettings element of the Web.config file is used to define the custom settings for a Web application. For example, you can use the appSettings element to store the connection string in the database that you need to access in the various Web Forms of a Web application.

Which of the following statements about a cookie is true?
1. A cookie is a server-side state management option.
2. A cookie is stored on a Web server.
3. A cookie can be either temporary or persistent.
4. A cookie contains application-specific information.

Correct Answer: -> 3

Feedback: -> That’s correct. A cookie can be either temporary or persistent. A temporary cookie, also known as a session cookie, exists in the memory space of a browser. When the browser is closed, all the session cookies added to the browser are lost. A persistent cookie is saved as a text file in the file system of the client computer.

Which of the following types of deployment projects will you use to deploy an ASP.NET application?

1. A setup project
2. A Web setup project
3. A merge module project.
4. A cab project

Correct Answer: -> 2

Feedback: -> That’s correct. A Web setup project is used to package a Web-based application and create a Windows Installer (.msi) file.

The armed forces of a small nation want to develop an Intranet site to manage the stock of arsenal in their stores as well as at forward positions. The armed forces are concerned about espionage and sabotage. Therefore, security is a very important aspect of the application. In the given scenario, which authentication scheme will be the most appropriate?

1. Basic authentication
2. Integrated Windows authentication
3. Anonymous authentication
4. Passport authentication

Correct Answer: -> 2
Feedback: -> That’s incorrect. As per the scenario, the armed forces are concerned about espionage and sabotage. However, in basic authentication, the password of a user is transmitted over a network in an unencrypted form. This makes the password vulnerable to security breaches. Therefore, basic authentication cannot be used in the given scenario.

How can you bind the value entered in the TextBox control txtCity to the Label control Label1?
1. By setting the DataSource property of the Label1 control to txtCity
2. By setting the DataMember property of the Label1 control to txtCity
3. By setting the Text property of the Label1 control to txtCity.Text
4. By using the DataBindings property of the Label1 control and setting the custom binding _expression to txtCity.Text

Correct Answer: -> 4
Feedback: -> That’s correct. To specify the data binding _expression for the Label1 control, you need to click the DataBindings property to open the Label1 DataBindings dialog box. Then, you need to click the Custom binding _expression radio button and specify the data binding _expression in the text box.

You have created a DataList control and added a Button control to it. You have not set the CommandName property of the Button control. Which of the following events will be generated when a user clicks the Button control?
1. EditCommand
2. UpdateCommand
3. ItemCommand
4. CancelCommand

Correct Answer: -> 3

Feedback: -> That’s correct. The ItemCommand event is generated when you click a Button control with no predefined CommandName.

Which file contains the scripts that define the start and end events of an ASP.NET application and its sessions?
1. AssemblyInfo.cs
2. Global.asax
3. Web.Config
4. WebApplication.vsdisco
Correct Answer: -> 2
Feedback: -> That’s incorrect. The Web.Config file is an XML file that contains configuration data on each unique URL resource used in an ASP.NET Web project.

You have created the errors.html file to display error messages for your ASP.NET application. You want to redirect a client browser to the errors.html file whenever an error occurs in the ASP.NET application. How can this be achieved?
1. By setting the defaultRedirect attribute of the customErrors element to “errors.html”
2. By setting the mode attribute of the customErrors element to “errors.html”
3. By setting the defaultRedirect attribute of the appSettings element to “errors.html”
4. By setting the redirect attribute of the customErrors element to “errors.html”

Correct Answer: -> 1
Feedback: -> That’s correct. The defaultRedirect attribute of the customErrors element is used to specify the URL to which the client browser should be redirected when an error occurs.

Which of the following statements will you use in the Web.Config file to specify that an ASP.NET application should use one of the IIS authentication schemes?

1.
2.
3.
4.
Correct Answer: -> 1

Feedback: -> That’s correct. The Windows authentication mode allows you to specify that ASP.NET application should use one of the IIS authentication schemes.

Which of the following statements about the ViewState property is true?
1. The ViewState property is a server-side state management option.
2. By default, the ViewState property of both Web pages and the controls on the Web pages is disabled.
3. Each Web Form page and the controls on the page have the ViewState property that is inherited from the base Control class.
4. The ViewState property should be enabled when you have a large volume of information to maintain.
Correct Answer: -> 3

Feedback: -> That’s incorrect. The ViewState property is a client-side state management option.

Which control allows you to display banner advertisements on an ASP.NET Web Form?
1. A DataGrid control
2. A Repeater control
3. An XML Web server control
4. An AdRotator control
Correct Answer: -> 4

Feedback: -> That’s correct. An AdRotator control allows you to display banner advertisements on an ASP.NET Web Form.

Which of the following classes provides forward-only access to a stream of XML data and checks whether or not an XML document is well-formed?

1. XmlDocument
2. XmlTextReader
3. XmlTextWriter
4. XPathDocument
Correct Answer: -> 2

Feedback: -> That’s correct. The XmlTextReader class provides forward-only access to a stream of XML data and checks whether or not an XML document is well-formed.

The XML Web server control belongs to which namespace?

1. System.Xml
2. System.Xml.Xsl
3. System.Web.UI.WebControls
4. System.Web.UI

Correct Answer: -> 3
Feedback: -> That’s incorrect. The System.Xml namespace provides a rich set of classes for processing XML data.

Which event is generated when a control triggers the reloading of an ASP.NET Web page?
1. Init
2. Load
3. Control
4. Unload

Correct Answer: -> 3

Feedback: -> That’s incorrect. The Load event is generated when an ASP.NET Web page is loaded into memory.

Which of the following state management options can be used to submit information to another page by using a URL?
1. The Viewstate property
2. Hidden fields
3. Cookies
4. Query strings
Correct Answer: -> 4

Feedback: -> That’s correct. Query strings are used if you need to submit information another page by using a URL.

No comments: