Top Posters
Since Sunday
g
3
3
2
J
2
p
2
m
2
h
2
s
2
r
2
d
2
l
2
a
2
A free membership is required to access uploaded content. Login or Register.

Applications with Visual Basic Net.docx

Uploaded: 6 years ago
Contributor: redsmile
Category: Operating Systems
Type: Other
Rating: N/A
Helpful
Unhelpful
Filename:   Applications with Visual Basic Net.docx (335.23 kB)
Page Count: 257
Credit Cost: 1
Views: 1062
Last Download: N/A
Transcript
Developing and Implementing Web Applications with Microsoft Visual Basic NET QUESTION You work as the Web developer at Certkiller com You are developing an ASP NET application which will be used on the intranet site of Certkiller com All Certkiller com's employees use Internet Explorer on the company intranet Multiple controls that postback to the server for event processing are contained in a page named UserAccount aspx To complete processing the event handlers of the controls require access to a database Whenever the UserAccount aspx page executes a postback to the server the browser window goes blank for a few moments while the page is being refreshed The specific control which has the focus before the postback was performed does not have the focus once the page is re-rendered This tends to be very confusing to users and often results in users making invalid data entries You want to configure the UserAccount aspx page so as to prevent the browser window from being blank after a postback You also want to maintain the correct control focus once events are processed You want to use the the minimum amount of development effort to accomplish these tasks How will you accomplish the task For controls that perform the postbacks include the following attribute with the HTML code RunAt client For controls that perform the postbacks include the following attribute with the HTML code EnableViewState True Insert the following attribute to the Page directive for the UserAccount aspx page SmartNavigation True Insert the following attribute to the OutputCache directive for the UserAccount aspx page Location client Answer C Explanation When a page is requested by an Internet Explorer browser or later smart navigation enhances the user's experience of the page by performing the following eliminating the flash caused by navigation persisting the scroll position when moving from page to page persisting element focus between navigations retaining only the last page state in the browser's history Smart navigation is best used with ASP NET pages that require frequent postbacks but with visual content that does not change dramatically on return Reference NET Framework Class Library Page SmartNavigation Property Visual Basic QUESTION You work as the Web developer at Certkiller com You have developed a financial application named Certkiller App which is written in Visual Basic NET Certkiller App consists of a page named AnnualFigures aspx and a page class named AnnualFigures AnnualFigures aspx exists in the Finance namespace A Certkiller com employee named Andy Reid works as a developer in the IT department One morning you notice that FirstQuarter aspx is not functioning correctly You investigate the issue and find out that Andy has accidentally deleted the Page directive for FirstQuarter aspx You must create a new Page directive to configure FirstQuarter aspx to function correctly Choose the Page directive which you should use to accomplish the task Page Language vb Codebehind AnnualFigures aspx vb Inherits AnnualFigures Page Language vb Codebehind AnnualFigures aspx vb ClassName Finance AnnualFigures Page Language vb Codebehind AnnualFigures aspx vb Inherits Finance AnnualFigures Page Language vb Codebehind AnnualFigures aspx vb ClassName Finance AnnualFigures Inherits AnnualFigures Answer C Explanation The Inherits attribute in the Page directive defines a code -behind class for the page to inherit As AnnualFigures aspx resides within the Finance namespace we should use Inherits Finance AnnualFigures Note The Page directive defines page-specific aspx file attributes used by the ASP NET page parser and compiler Reference NET Framework General Reference Page Incorrect Answers A As AnnualFigures aspx resides within the Finance namespace we should use Inherits Finance AnnualFigures B D The ClassName attribute specifies the class name for the page that will by dynamically compiled automatically when the page is requested We should not use ClassName here QUESTION You work as the Web developer at Certkiller com You develop an ASP NET page named Enlist aspx Enlist aspx will used by Certkiller com's users to subscribe to Certkiller com's e-mail lists The Enlist aspx page contains an existing user control named ListEnlist ListEnlist consists of two constituent controls and is specified in the ListEnlist ascx file The TextBox control is named listNameText and the Button control is named enlistButton You want to include ListEnlist in the Enlist aspx page You do this by configuring this tag email ListEnlist id ctlEnlist runat server You now want the page to display the list name in ListNameLabel when a user subscribes to Certkiller com's e-mail lists by providing a list name in listNameText and then clicking the enlistButton Which two actions should you perform to achieve your goal in these circumstances Choose two correct answers Each answer presents only part of the complete solution A Include this statement in the declaration section of ListEnlist aspx Public listNameText As TextBox Include this statement in the declaration section of Enlist aspx Public listNameText As TextBox Include this statement in the Page Load event handler for Enlist aspx If Not Page IsPostBack Then listNameLabel Text ctlEnlist listNameText Text End If Include this statement in the Page Load event handler for Enlist aspx If Page IsPostBack Then listNameLabel Text ctlEnlist listNameText Text End If Include this statement in the Page Load event handler for ListEnlist ascx If Not Page IsPostBack Then listNameLabel Text listNameText Text End If Include this statement in the Page Load event handler for ListEnlist ascx If Page IsPostBack Then listNameLabel Text listNameText Text End If Answer A D Explanation We must expose the listNameText control by declaring it as public The ListEnlist aspx file contains the listNameText control so we expose it in this file Note The controls that make up a user control are called constituent controls These controls are normally declared private and thus cannot be accessed by the developer If you want to make properties of these controls available to future users you must expose them to the user If the control is reloaded in the Enlist aspx file due to a response to a client postback we should set the listNameLabel Text property Note The UserControl IsPostBack property gets a value indicating whether the user control is being loaded in response to a client postback or if it is being loaded and accessed for the first time Reference Visual Basic and Visual C Concepts Exposing Properties of Constituent Controls NET Framework Class Library UserControl IsPostBack Property Incorrect Answers The listNameText control is defined in ListEnlist aspx not in Enlist aspx This would only copy the text when the page is initially loaded E F We should use the Page Load event of Enlist aspx not for ListEnlist aspx QUESTION You work as the Web developer at Certkiller com You develop an ASP NET page named Region aspx Region aspx includes a Web user control named CountryList that contains countries in a drop-down list box The DropDownList control in CountryList ascx is named CKCountry You want to configure a code segment for the Page Load event handler for Region aspx You find though that you are unable to access CKCountry from code in Region aspx What should you do next to enable the code in Region aspx to access the properties of CKCountry In the code-behind file for CountryList ascx include this code Protected CKCountry As DropDownList In the code-behind file for CountryList ascx include this code Public CKCountry As DropDownList In the code-behind file for RegionList aspx include this code Protected CKCountry As DropDownList In the code-behind file for Region aspx include this code Public CKCountry As DropDownList Answer B Explanation We must declare the CKCountry as public in the file in which it is defined CountryList ascx Note The Public keyword in the Dim statement declares elements to be accessible from anywhere within the same project from other projects that reference the project and from an assembly built from the project Reference Visual Basic Language Concepts Accessibility Incorrect Answers A C The Protected keyword in the Dim statement declares elements to be accessible only from within the same class or from a class derived from this class However you do not want to protect MyCount at the contrary we must make it public D We must declare it public in the file in which it is defined not Region aspx where it is only used QUESTION You work as the Web developer at Certkiller com You develop a new user control named PostalAddress PostalAddress is defined in the PostalAddress ascx file and is configured to exhibit address fields in an HTML table Certain container pages consist of multiple instances of the PostalAddress user control To differentiate between these instances you create a public property named Description for the user control You must perform the configuration that will result in the description appearing in the first td element of the HTML table containing the address fields Choose the code which you should include in the td element of the HTML table to exhibit the description td Description td td script runat server Description script td td script document write Description scripts td td Description td Answer A Explanation CKDescription is a public property contained on the Web server We reference it with the CKDescription element Incorrect Answers B C Scrips are not called for We just want to display a property D To access the public property we must use an element QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET page for an application named Certkiller App The new ASP NET page will be used to indicate areas where a user can click to set off various functions Users that use Certkiller App use Internet Explorer You want to perform the necessary configuration which will result in a pop-up window being displayed when the user moves the mouse pointer over an image The pop-up window should detail the function which will be started should the user proceed to click the particular image How will you accomplish the task For each specific image configure the AlternateText property to list the text which should be displayed to the user Change the ToolTip property to True For each specific image configure the ToolTip property to to list the text which should be displayed to the user For each specific image in the onmouseover event handler include code which calls the RaiseBubbleEvent method of the System Web UI WebControls Image class For each specific image in the onmouseover event handler include code which calls the ToString method of the System Web UI WebControls Image class Answer B Explanation WebControl ToolTip property gets or sets the text displayed when the mouse pointer hovers over the Web server control The use of the ToolTip property meets the requirement of this scenario Reference NET Framework Class Library WebControl ToolTip Property Visual Basic Incorrect Answers A The AlternateText property is used to specify the text to display if the image is not available C The RaiseBubbleEvent is not useful here Note ASP NET server controls such as the Repeater DataList and DataGrid Web controls can contain child controls that raise events Rather than each button raising an event individually events from the nested controls are bubbled -that is they are sent to the control's parent D The ToStringMethod would not by itself provide the functionality required QUESTION You work as the Web developer at Certkiller com You develop a new class named CkFormat CkFormat contains two public properties named Size and Color respectively You plan to use the CkFormat class in custom server controls to expose format properties to container pages You configure the following code for a custom control named MessageRepeater Private formatter As CkFormat New CkFormat Public ReadOnly Property Format As CkFormat Get Return formatter End Get End Property To test the custom control you define a container page named MessageContainer aspx and then use this code to register it Register Tagprefix CertK ctl Namespace MessageControls Assembly MessageControls You want the custom server control instance of the control to test page with the following parameters set a size property of a color of green Choose the code segment which you should use to accomplish the task CertK ctl MessageRepeater Format-Color green Format-Size CertK ctl MessageRepater Format-Color green Format-Size runat server CertK ctl MessageRepeater Color green Size runat server CertK ctl MessageRepeater Format color green size Answer B Explanation ASP NET has a special syntax for setting subproperties The - syntax denotes a subproperty The Format Color and Format Size properties are denoted by Format-Color and Format-Size respectively We should also specify that the control should run at the server Incorrect Answers A As this is a custom server control we should specify that it should run at the server C D We must use the - syntax denotes a subproperties QUESTION You work as the Web developer at Certkiller com You develop a custom server control to exhibit date and time information You want all other Certkiller com developers that use the custom server control to modify the style properties of a Label control named timeLabel which shows the date and time information You decide to create custom property procedures to accomplish your task You create a custom property procedure that changes the BackColor property of the constituent controls and you create a custom property procedure that changes the ForeColor property of the constituent controls You also want to provide users with the choice of choosing between two predefined styles You use the following function to create the required predefined styles but you still need to configure a method that will apply the styles Function GetStyle styleType As Integer As Style Dim ckStyle As Style New Style Select Case styleType Case ckStyle ForeColor System Drawing Color White ckStyle BackColor System Drawing Color Black Case ckStyle ForeColor System Drawing Color Black ckStyle BackColor System Drawing Color White End Select Return ckStyle End Function You want to configure your method so that the ForeColor property and BackColor property of the Label control is not overwritten when they were previously set via the custom property procedures Choose the code segment you should use to accomplish the task Public Sub PickStyle styleType As Integer Dim ckStyle As Style GetStyle styleType timeLabel ApplyStyle ckStyle End Sub Public Sub PickStyle styleType As Integer Dim ckStyle As Style GetStyle styleType TimeLabel MergeStyle ckStyle End Sub Public Sub PickStyle styleType As Integer Dim ckStyle As Style GetStyle styleType timeLabel ForeColor ckStyle ForeColor timeLabel BackColor ckStyle BackColor End Sub Public Sub PickStyle styleType As Integer Dim ckStyle As Style GetStyle styleType TimeLabel CssClass ckStyle CssClass End Sub Answer B Explanation The WebControl MergeStyle method copies any nonblank elements of the specified style to the Web control but will not overwrite any existing style elements of the control This method is used primarily by control developers Reference NET Framework Class Library WebControl MergeStyle Method Visual Basic Incorrect Answers A WebControl ApplyStyle Method copies any nonblank elements of the specified style to the Web control overwriting any existing style elements of the control We don't want to overwrite any existing style elements however We don't want to overwrite any existing style elements - The WebControl CssClass Property gets or sets the Cascading Style Sheet CSS class rendered by the Web server control on the client It not useful in this scenario though QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used for the Internet Web site of Certkiller com You must develop a toolbar for Certkiller App The toolbar must not be used by any other application and must contain only static HTML code The toolbar must be exhibited at the top of each page in the Internet Web site You also want to develop the toolbar as quickly as feasible To achieve your goals you decide to configure the toolbar as a reusable component for Certkiller App What should you do next Develop a new Web Control Library project and then create the toolbar within a Web custom control Configure a new Web user control for the ASP NET project and then create the toolbar within the Web user control Configure a new Web Form for the ASP NET project and then use HTML server controls to create the required toolbar within the Web Form Save the Web Form by using an ascx extension Configure a new component class for the ASP NET project and then use HTML server controls to create the required toolbar within the designer of the new component class Answer B Explanation Web user controls enable you to easily define controls as you need them for your applications using the same programming techniques that you use to write Web Forms pages Reference Visual Basic and Visual C Concepts Introduction to Web User Controls Incorrect Answers A You can use the Web Control Library project template to author custom Web server controls However since the toolbar is only going to be used in this application there is no need of the complexity of a Web customer control An HTML server control would be inadequate The Component class provides the base implementation for the IComponent interface and enables object-sharing between applications It does not fit in this scenario QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used for the online vehicle cover site of Certkiller com You have configured the following Page directive for the VehicleInformation aspx page Page Language VB CodeBehind VehicleInformation aspx vb AutoEventWireup false inherits InsApp VehicleInfo The VehicleInformation aspx page contains a TextBox control named vehicleIDNumber Users use the vehicleIDNumber control to enter the vehicle registration number of a vehicle The code segment for the vehicleIDNumber control is as follows asp TextBox ID vehicleIDNumber Columns Runat server You must configure a TextChanged event handler for the vehicleIDNumber control You must ensure that the TextChanged event handler retrieves information on vehicles via an XML Web service that charges for each data access attempt Each page displayed will contain information on the specific vehicle retrieved from the XML Web service What should you do next to implement the TextChanged event handler Choose the two actions which you should perform Each correct answer presents only part of the complete solution Access the Page directive for VehicleInformation aspx and set the AutoEventWireup attributes to true Access the Page directive for VehicleInformation aspx and set the EnableViewState attribute to true Access the vehicleIDNumber HTML element and set the AutoPostback attribute to false Add the necessary code for the client-side onserverchange event to submit the Web Form for processing by the server In the vehicleIDNumber HTML element ensure that the AutoPostback attribute is set to true Add the necessary code in the TextChanged event handler to query the XML Web service Answer B D Explanation The Page EnableViewState property value indicates whether the page maintains its view state and the view state of any server controls it contains when the current page request ends The AutoPostBack property is used to specify whether an automatic postback to the server will occur whenever the user changes the content of the text box As we want we want to use an XML Web service we must set the attribute to true Reference NET Framework Class Library Control EnableViewState Property Visual Basic NET Framework Class Library TextBox AutoPostBack Property Visual Basic Incorrect Answers AutoEventWireup is used to automatically associate page events and methods It does not provide a solution for this scenario We are required to use a XML Web service The AutoPostback attribute must be set to false QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used by the Sales department to process customers' orders for goods and services Certkiller App contains a DeliveryInformation aspx page DeliveryInformation aspx provides a Web Form that has controls to gather information on delivery locations The Web Form consists of the TextBox controls a Button control and a DropDownList control There are four TextBox controls that are used to specify name street address city and postal code information The DropDownList control contains the names of several countries The Button control is named deliveryItButton The Click event handler for the deliveryItButton control resides within the code-behind file for DeliveryInformation aspx and is the only control that defines server-end event handlers The Click event handler works by redirecting the user to a page named DeliveryConfirmation aspx which provides the confirmation status of the delivery request A Certkiller com user named Mia Hamm is a member of the Sales department One morning Mia and other users complain that when they click the deliveryItButton DeliveryInformation aspx processes the request for a long time Mia is using a dial- up connection to access Certkiller App You investigate the complaint and discover that the slow performance issue only pertains to users that use dial-up connections to access Certkiller App Users that use high-bandwidth network connections are experiencing no performance issues What should you do next to improve performance for users using dial-up connection to access Certkiller App A Include this attribute to the Page directive for DeliveryInformation aspx EnableViewState False Include this attribute to the Page directive for DeliveryInformation aspx SmartNavigation True Include this attribute to the OutputCache directive for DeliveryInformation aspx Location server Include this attribute to the OutputCache directive for DeliveryInformation aspx Location client Answer A Explanation The Page EnableViewState property gets or sets a value indicating whether the page maintains its view state and the view state of any server controls it contains when the current page request ends You can use the ViewState property to save your values independent of control state between round trips to the server The ViewState property is stored in the page in a hidden form field However this introduces higher network load when the page is redisplayed Reference NET Framework Class Library Page EnableViewState Property Visual Basic Incorrect Answers The SmartNavigation property does not affect problems of this scenario Server side caching would not decrease network traffic Note The OutputCache directive declaratively controls the output caching policies of an ASP NET page or a user control contained in a page D Client side caching would not so useful in this scenario QUESTION You work as the Web developer at Certkiller com All of Certkiller com's users on the intranet make use of Internet Explorer You configure a new ASP NET page named Schedule aspx Schedule aspx will be used by the Project office to maintain information on the time-frames and status of various projects Users can access Schedule aspx from several ASP and ASP NET pages hosted throughout Certkiller com's intranet Schedule aspx contains a Calendar control located close to the top of the page Below this users are presented with information on the project schedules on the date which they have selected After a user clicks a specific date within the calendar Schedule aspx refreshes to display schedule information for the specified date You have received several complaints from users complaining that once they have selected to view information on two or more dates on Schedule aspx they are forced to click the Back button of the browser multiple times to return to the page which they were looking at before accessing Schedule aspx You must configure Schedule aspx in order that users only need to click the browser's Back button once What should you do next Insert this statement to the Page Load event handler for Schedule aspx Response Expires Insert this statement to the Page Load event handler for Schedule aspx Response Cache SetExpires DateTime Now Insert this attribute to the Page directive for Schedule aspx EnableViewState True D Insert this attribute to the Page directive for Schedule aspx SmartNavigation True Answer D Explanation the user's experience of the page by performing the following retaining only the last page state in the browser's history This is what is required in this scenario eliminating the flash caused by navigation persisting the scroll position when moving from page to page persisting element focus between navigations Reference NET Framework Class Library Page SmartNavigation Property Visual Basic Incorrect Answers This is not a page expiration problem This is not a caching problem The Page EnableViewState property Gets or sets a value indicating whether the page maintains its view state and the view state of any server controls it contains when the current page request ends QUESTION You are creating an e-commerce site for Certkiller Your site is distributed across multiple servers in a Web farm Users will be able to navigate through the pages of the site and select products for purchase You want to use a DataSet object to save their selections Users will be able to view their selections at any time by clicking a Shopping Cart link You want to ensure that each user's shopping cart DataSet object is saved between requests when the user is making purchases on the site What should you do A Create a StateBag object Use the StateBag object to store the DataSet object in the page's ViewState property Use the HttpSessionState object returned by the Session property of the page to store the DataSet object Use the Web config file to configure an out-of-process session route Use the Cache object returned by the page's Cache property to store a DataSet object for each user Use an HttpCachePolicy object to set a timeout period for the cached data Use the Session Start event to create an Application variable of type DataSet for each session Store the DataSet object in the Application variable Answer B Explanation An HttpSessionState object provides access to session-state values as well as session- level settings and lifetime management methods We should use an out-of-process session to ensure that each user's shopping cart DataSet object is saved between requests Note ASP NET provides three distinct ways to store session data for your application in-process session state out-of-process session state as a Windows service and out-of-process session state in a SQL Server database The out-of-process solutions are primarily useful if you scale your application across multiple processors or multiple computers or where data cannot be lost if a server or process is restarted Reference NET Framework Class Library HttpSessionState Class Visual Basic NET Framework Developer's Guide Developing High-Performance ASP NET Applications Visual Basic Incorrect Answers A A StateBag object manages the view state of ASP NET server controls including pages This object implements a dictionary It would not be useful in this scenario however A cache is not a secure storage location As multiple servers are going to be used an Application variable is not the best solution QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET page to save insurance information on new employees To be included in Certkiller com's insurance plan employees must be minimally years old You have received instruction from the CIO to have each new member provide the following information A name in the TextBox control named nameTextBox Date of birth information in a TextBox control named birthTextBox You must also ensure that all new members meet the minimum age requirement What should you do to achieve your goal in these circumstances Add a CustomValidator to your page and in the Properties window specify the ControlToValidate property to birthTextBox Configure the code segment to validate date of birth information Add a RegularExpressionValidator control to your page and in the Properties window specify the ControlToValidate property to nameTextBox Configure a regular expression to validate name information Add a CompareValidator control to your page and in the Properties window specify the ControlToValidate property to birthTextBox Configure the code segment to specify the Operator and ValueToCompare properties to validate date of birth information Add a RequiredFieldValidator control to your page and in the Properties window specify the ControlToValidate property to nameTextBox Add a RangeValidator control to your page and in the Properties window specify the ControlToValidate property to birthTextBox Configure the code segment to set the MinimumValue and MaximumValue properties to validate date of birth information Add a CompareValidator control to your page and in the Properties window specify the ControlToValidate property to nameTextBox Add another CompareValidator control to your page and in the Properties window specify the ControlToValidate property to birthTextBox Configure the code segment that sets the Operator and ValueToCompare properties of each CompareValidator control to validate name and date of birth information Add a CustomValidator control to your page and in the Properties window specify the ControlToValidate property to birthTextBox Configure a code to validate date of birth information Add a RequiredFieldValidator control to your page and in the Properties window specify the ControlToValidate property to nameTextBox Add another RequiredFieldValidator control to the page and in the properties window specify the ControlToValidate property to birthTextBox Answer D Explanation To check the data of the birthTextBox we can use a CustomValidator control page and add appropriate program code to validate that the birth date is in the correct range We use two RequiredFieldValidators to ensure that both textboxes are non-empty Note The CustomValidator Control evaluates the value of an input control to determine whether it passes customized validation logic The RequiredFieldValidator Control evaluates the value of an input control to ensure that the user enters a value Reference NET Framework General Reference RequiredFieldValidator Control Incorrect Answers The RegularExpressionValidator control evaluates the value of an input control to determine whether it matches a pattern defined by a regular expression It is not useful in this scenario We should use two RequiredFieldValidtor one for each textbox It would be hard to use a RangeValidator for the birthday Textbox It is better to use a CustomerValidator control QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET page to save contact details Your ASP NET page consists of the following controls A TextBox control named emailTextBox A TextBox control named phoneTextBox A RequiredFieldValidator control named emailRequired A RequiredFieldValidator control named phoneRequired Information must be provided in emailTextBox and in phoneTextBox The ControlToValidate property of emailRequired is set to emailTextBox and the ControlToValidate property of phoneRequired is set to phoneTextBox You also include a ValidationSummary control close to the end the page You want to perform the following configurations When a user attempts to submit your page and emailTextBox is left blank you want the word 'Required to pop-up next to the associated text box When a user attempts to submit the page and phoneTextBox is left blank you want the word 'Required to pop-up next to the associated text box When a user attempts to submit the page and emailTextBox and phoneTextBox are left blank you want word 'Required to pop-up at the end of the page You want a user to be presented with a bulleted list that indicates which information is required and is missing When emailTextBox is left blank the bulleted list must display this E-mail is required When phoneTextBox is left blank the bulleted list must display this Phone number is required What should you do to achieve your goal in these circumstances Configure the InitialValue property of each RequiredFieldValidator control as Required Configure the ErrorMessage property of emailRequired as E-mail is required Configure the ErrorMessage property of phoneRequired as Phone number is required Configure the Display property of each RequiredFieldValidator control to Dynamic Configure the ErrorMessage property of emailRequired and phoneRequired to Dynamic Configure the Text property of emailRequired to E-mail is required Configure the Text property of phoneRequired to Phone number is required Configure the InitialValue property of each RequiredFieldValidator control to Required Configure the Text property of emailRequired to E-mail is required Configure the Text property of phoneRequired to Phone number is required Configure the Text property of each RequiredFieldValidator control to Required Configure the ErrorMessage property of emailRequired to E-mail is required Configure the ErrorMessage property of phoneRequired to Phone number is required Answer D Explanation The Text property of the RequiredFieldValidator is used to specify the text to display in the validation control We want to display Required The ErrorMessage property is used to specify the text to display in the validation control when validation fails Reference Visual Basic and Visual C Concepts Validating Required Entries for ASP NET Server Controls NET Framework Class Library RequiredFieldValidator Members Incorrect Answers We should use the Text property not the InitialValue property to specify the text to display in the validation control The ErrorMessage property should be set to the text to display in the validation control not to dynamic We must use the ErrorMessage property QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET page to enable Certkiller com's customers to supply payment information on goods purchased Your page includes a DropDownList control named CardTypeList CardTypeList will be used by customers to choose the type of credit card they are using to make payment CardTypeList must have a default value of Select It is compulsory for all customers to specify a credit card type To ensure that this requirement is adhered to you want the page validation to fail when a customer fails to select a credit card type How will you accomplish your goal Include a RequiredFieldValidator control for your page and set its ControlToValidate property to CardTypeList Configure the InitialValue property of the RequiredFieldValidator control as Select Include a RequiredFieldValidator control for your page and set its ControlToValidate property to CardTypeList Configure the DataTextField property of the CardTypeList control as Select Include a CustomValidator control for your page and set its ControlToValidate property to CardTypeList Configure the DataTextField property of the CardTypeList control as Select Include a RegularExpressionValidator control for your page and set its ControlToValidate property a CardTypeList Configure the ValidateExpression property of the RegularExpressionValidator control as Select Answer A Explanation We use a RequiredFieldValidator control to ensure that users enter a CardTypeList We use the InitialValue property of the RequiredFieldValidator control to specify the default or initial value of the CardTypeList control Note The RequiredFieldValidator Control evaluates the value of an input control to ensure that the user enters a value RequiredFieldValidator InitialValue property gets or sets the initial value of the associated input control QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET page to enable Certkiller com's users to supply requested delivery date information The TextBox control named requestCKDate must be used to enter this delivery information The requested delivery date must adhere to these requirements Cannot be earlier than three business days after the order date Cannot be later than fifty business days after the order date You want to perform the configuration which will ensure that the requested delivery date meets these requirements You also want to minimize the number of round trips to the server What should you do next A Specify the AutoPostBack property of requestDate as False Configure a code segment in the ServerValidate event handler to validate the delivery date B Specify the AutoPostBack property of requestDate as True Configure a code segment in the ServerValidate event handler to validate the delivery date C Specify the AutoPostBack property of requestDate as False Specify the ClientValidationFunction property to the name of a script function contained in the HTML page that is passed to the browser D Specify the AutoPostBack property of requestDate as True Specify the ClientValidationFunction property to the name of a script function contained in the HTML page that is passed to the browser Answer C Explanation Set CustomValidator ClientValidationFunction property to the name of the function that performs the client-side validation Because the client validation function runs on the target browser the function must be written using a scripting language supported by the browser such as JScript or VBScript The AutoPostBack property gets or sets a value indicating whether an automatic postback to the server will occur whenever the user changes the content of the text box We should set it to false as we want to avoid server round trips Reference NET Framework Class Library CustomValidator ClientValidationFunction Property Visual Basic NET Framework Class Library TextBox AutoPostBack Property Visual Basic Incorrect Answers A B We want to validate the control with client side script to save a server round-trip D If the AutoPastBack is set to true an automatic postback to the server will occur whenever the user changes the text in the text box This is what we want to avoid QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application named Certkiller App Certkiller App will run on the Internet Web site of the company and will contain a substantial number of Web pages You want to configure Certkiller App to display customized error messages to users when an HTTP code error occurs and you want the error logged when ASP NET exceptions occur You want to use the minimum amount of development effort to implement these configurations Choose the two actions which you should perform Each correct answer presents only part of the complete solution Create an Application Error procedure in the Global asax file to enable Certkiller App to deal with ASP NET code errors Create an applicationError section in the Web config file to enable Certkiller App to deal with ASP NET code errors Create a CustomErrors event in the Global asax file to enable Certkiller App to deal with HTTP errors Create a customErrors section in the Web config file to enable Certkiller App to deal with HTTP errors Add the Page directive to each page in Certkiller App to deal with ASP NET code errors Add the Page directive to each page in Certkiller App to deal with HTTP errors Answer A D Explanation A Any public event raised by the HttpApplication class is supported using the syntax Application EventName For example a handler for the Error event can be declared protected void Application Error Object sender EventArgs e D The customErrors element which is used in the Web config file provides information about custom error messages for an ASP NET application Reference NET Framework Developer's Guide Handling Public Events NET Framework General Reference customErrors Element Incorrect Answers There is no such thing as a applicationError section in the Web config file There is no such thing as CustomErros event in the Global asax file E F It is not necessary to add a Page Directive to each page QUESTION You work as the Web developer at Certkiller com You have been tasked with migrating Certkiller com's ASP-based Web page named Booklist asp to ASP NET Booklist asp consists of a COM component named Company BookList which is written in Microsoft Visual Basic You want the migration to take place as quickly as possible and you want to use the minimum amount of development effort to perform it After opening the new page you are presented with this error message Server error - The component 'Company BookList' cannot be created What should you do next so that the new page is successfully opened Configure a managed component to perform the functions currently performed by the Company BookList component Configure the AspCompat attribute of the Page directive as True Include this code to the Page Load event handler RegisterRequiresPostBack Company BookList Include this attribute to the processModel element of the Web config file comImpersonationLevel Delegate Answer B Explanation If the older file contains calls to COM components - for example ADO code then we must add the AspCompat attribute to the page directive in HTML view The aspcompat attribute forces the page to execute in single-threaded STA mode Note You can work with and run existing ASP pages asp files as-is in Visual Studio You can use ASP pages and ASP NET pages in the same project It is useful to convert ASP pages to ASP NET Web Forms pages so that you can take advantage of the enhanced features of the newer architecture Reference Visual Basic and Visual C Concepts Migrating ASP Pages to Web Forms Pages QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET page that will be used by Certkiller com's users to choose a destination After selecting a destination users must be presented with tourist information pertaining to that specific destination To specify a destination users select the destination by using the countryList list box countryList has hidden country code information You configure the necessary code to retrieve a cached DataTable object named touristTable This DataTable object holds the tourist description and a numeric country code named CountryID You must extract an array of DataRow objects from the DataTable object and want to only include tourist information for the selected county How will you accomplish the task Dim result As DataRow touristTable Select CountryID countryList SelectedItem Text Dim result As DataRow touristTable Select CountryID countryList SelectedItem Value Dim result As DataRow touristTable Rows Find CountryID countryList SelectedItem Value D Dim result As DataRow touristTable Rows Find countryList SelectedItem Value Answer B Explanation The DataTable Select method gets an array of all DataRow objects that match the filter criteria in order of primary key or lacking one order of addition The filter will compare CountryID values We should use Country codes and not country names We should therefore use the Value of the selected item not the Text Reference NET Framework Class Library DataTable Select Method String Visual Basic NET Framework Class Library ListControl SelectedItem Property Visual Basic Incorrect Answers A The ListBox TextBox property gets or searches for the text of the currently selected item in the ListBox However this would retrieve names of countries but the filter use comparison to a CountryID column We must use the country code not the country name C D The DataRowCollection Find method is not appropriate in this scenario It retrieves only a single row not an array of rows QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application named Certkiller App Certkiller App will be used to send Certkiller com news over the Internet Certkiller com users select news content from an ASP NET page You have configured code that creates a DataSet object named NewsItems NewsItems holds the news content that meet the requirements specified by the user You write this code to create a style sheet named NewsStyle xsl NewsStyle xsl will place the data in NewsItems in HTML format Dim doc As XmlDataDocument new XmlDataDocument NewsItems Dim tran As XslTransform New XslTransform tran Load NewsStyle xsl Choose the code that must be appended to the end of the code segment to show the transformed data as HTML text tran Transform doc Nothing Response OutputStream tran Transform doc Nothing Request InputStream NewsItems WriteXml Response OutputStream NewsItems WriteXml tran ToString Answer A Explanation The XslTransform Transform method transforms the XML data in the XPathNavigator using the specified args and outputs the result to a Stream We should use the Response OutputStream to enable output of text to the outgoing HTTP response stream Reference NET Framework Class Library XslTransform Transform Method XPathNavigator XsltArgumentList Stream Visual Basic Incorrect Answers B We want to display data not read data so we must use Response OutputStream not Request InputStream C D We want to generate HTML not XML data We should use the XslTransform Transform method not the DataSet WriteXml method QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application named Certkiller App Certkiller App will be used to present results to users of the company Web site You specify a DataGrid control to present a list of questions and the number of responses received for each question You must change the control with the result being that the total number of responses received is shown in the footer of the grid You want to use the minimum amount of development effort to achieve your goal What should you do next Override the OnPreRender event and then show the total number of responses received when the footer row is created Override the OnItemCreated event and then show the total number of responses received when the footer row is created Override the OnItemDataBound event and then show the total number of responses received when the footer row is bound Override the OnLayout event and and then show the total number of responses received in the footer row Answer C Explanation The ItemDataBound event is raised after an item is data bound to the DataGrid control This event provides you with the last opportunity to access the data item before it is displayed on the client After this event is raised the data item is nulled out and no longer available Reference NET Framework Class Library DataGrid ItemDataBound Event Visual Basic Incorrect Answers The OnPreRender method notifies the server control to perform any necessary prerendering steps prior to saving view state and rendering content The ItemCreated event is raised when an item in the DataGrid control is created both during roundtrips and at the time data is bound to the control The OnLayout Method raises the Layout event that repositions controls and updates scroll bars QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET page Your page will be used to show purchasing information on Certkiller com's customers The page uses the System Data SqlClient namespace and System Data namespace Your new page consists of two separate DataGrid controls One DataGrid control shows this year's purchasing information and one DataGrid control shows all previous years purchasing information All purchasing information is contained in a Microsoft SQL Server Database To retrieve a specific customer's purchasing information from the SQL database the customer's identification number is specified and a stored procedure named GetPurchases is called After the GetPurchases stored procedure runs the Page Load event handler populates a DataView object named CKDataView with the information You have configured this code in the Page Load event handler to bind the two DataGrid controls to CKDataView dataGridCurrentYear DataSource CKDataView CKDataView RowFilter PurchaseDate Now Year dataGridCurrentYear DataBind dataGridPreviousYears DataSource CKDataView CKDataView RowFilter PurchaseDate Now Year dataGridPreviousYears DataBind Page DataBind You test your configuration and find that each DataGrid control is showing purchasing information for only previous years What should you do next to ensure that one DataGrid control shows this year's purchasing information the other DataGrid control shows all previous years purchasing information Delete the Page DataBind statement Delete the dataGridPreviousYears DataBind statement Set a Response Flush statement immediately prior to the Page DataBind statement Set a Response Flush statement immediately prior to the dataGridPreviousYears DataBind statement Answer A Explanation Both datagrids use the same DataView The Page Databind method binds a data source to the invoked server control and all its child controls We should remove this statement Reference NET Framework Class Library Control DataBind Method Visual Basic Incorrect Answers B We must bind each data grid control to its data source C D The HttpResponse Flush method sends all currently buffered output to the client It is not useful in this scenario QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET page Your new page contains a DataGrid control that will be used to show all previous orders placed by users An existing database populates the DataGrid control when your page is created Your ASP NET page contains various TextBox controls which are used by users to change personal contact information You must implement the code that will result in the page being refreshed as quickly as possible when users update contact information What should you do next Change the Enable property of the DataGrid control to false Change the EnableViewState property of the DataGrid to false Add code in the Page Load event handler that populates the DataGrid control only if the IsPostBack property of the page is false Add code in the Page Load event handler that populates the DataGrid control only if the IsPostBack property of the page is true Answer D Explanation The Page IsPostBack property gets a value indicating whether the page is being loaded in response to a client postback or if it is being loaded and accessed for the first time The value is true if the page is being loaded in response to a client postback otherwise false By adding code in the Page Load event handler that populates the Data Grid control when the IsPostBack property is true we ensure that the page is refreshed as quickly as possible Reference NET Framework Class Library Page IsPostBack Property Visual Basic Incorrect Answers The DataGrid control has an Enabled property but no Enable property Furthermore the Enable property only indicates if the control is enabled or not The Control EnableViewState property indicates whether the server control persists its view state and the view state of any child controls it contains to the requesting client The DataGrid should only be populated when the user updates the contact information This occurs when the IsPostBack property is true not false This suggested solution would only populate the DataGrid when the page is loaded the first time QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application named Certkiller App Certkiller App includes a page that is used by the Sales department employees to change the prices of products and services offered by Certkiller com The code you configure uses the System Data namespace Your application works by retrieving product numbers and names and prices from a database All of this information is available on the Web page and is contained within a DataSet object named productInfo All Sales employees update product prices All modifications are saved to productInfo when the Save button is clicked You developed code in the Click event handler for the Save button to store changed prices to the database and now want to retrieve the changed rows in productInfo before performing the update To accomplish this you configure an additional DataSet object named productChanges to store all changed product information You must move the edited rows from productInfo into productChanges Choose the line of code which you should use productChanges productInfo GetChanges DataRowState Detached productChanges productInfo GetChanges productChanges Merge productInfo true productChanges Merge productInfo false Answer B Explanation The DataSet GetChanges method gets a copy of the DataSet containing all changes made to it since it was last loaded or since AcceptChanges was called Reference NET Framework Class Library DataSet GetChanges Method Visual Basic Incorrect Answers A The DataRowState is not relevant since we have not created any DataRows in this scenario C D We only want to extract the changes rows from the DataSet not merge the two DataSet QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET page Your page displays information to users via a DataGrid control Users are able to update the information contained within the grid The code you configure uses the System Data namespace and the System Data OleDb namespace Currently data updates made up users are saved in an ADO NET DataTable object You create a procedure that will save all user modifications to a database after the updates are made Public Shared Sub Update CertK Data ByVal sql As String ByVal connectionString As String ByVal dataTable As DataTable Dim da As New OleDb OleDbDataAdapter Dim cnn As New OleDb OleDbConnection connectionString dataTable AcceptChanges da UpdateCommand CommandText sql da UpdateCommand Connection cnn da Update dataTable da Dispose End Sub After implementing the procedure you discover that after the code executes no update data is saved to the database You verify that both the update query and the connection string that you are passing to the procedure is functioning as expected What changes should you make to your code so that all user data updates are added to the database Include these lines of code before calling the Update method Dim cb As New OleDb OleDbCommandBuilder da cd GetUpdateCommand Include this lines of code before calling the Update method da UpdateCommand Connection Open Remove the following line of code dataTable AcceptChanges Remove the following line of code da Dispose Answer C Explanation The DataTable AcceptChanges method commits all the changes made to this table since the last time AcceptChanges was called We should only use AcceptChanges after the updates has been made to the dataset Reference NET Framework Class Library DataTable AcceptChanges Method Visual Basic Incorrect Answers The OleDbCommandBuilder provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated database It is not useful here The OleDbConnection Open method opens a database connection with the property settings specified by the ConnectionString The DataAdapter Dispose method Releases the resources used by the DataAdapter It is a good practice to use it when the dataadapter no longer will be used QUESTION You work as the Web developer at Certkiller com You are writing code for an ASP NET application named Certkiller Certkiller will be used for booking flights to various destinations for Sales employees A Microsoft SQL Server database is used to hold information on all destinations You configure Certkiller so that users can request information on various destinations You must ensure that users can view the data in a DataGrid control and in read-only form The destinations specified by the user are stored in a form-level string variable named destinationCode You create a SqlConnection object named SqlConnection in the Page Load event handler You initialize SqlConnection and then call its Open method You define a local variable to store the destination code Dim dest As String destinationCode You want the data to be retrieved as quickly as possible What should you do next Create a stored procedure named GetDestinations Use this code to return the data Dim cmd As SqlCommand New SqlCommand GetDestinations sqlConnection cmd CommandType CommandType StoredProcedure Dim parm As SqlParameter New SqlParameter DestinationCode dest cmd Parameters Add parm dim sqlDataReader As SqlDataReader cmd ExecuteReader Create a stored procedure named GetDestinations Implement this code to return the data Dim qry As String EXEC GetDestinations WHERE DestID ' dest ' Dim da As SqlDataAdapter New SqlDataAdapter qry sqlConnection Dim ds As DataSet New DataSet da Fill ds Implement this code to return the data Dim qry As String SELECT FROM Destinations WHERE DestID ' dest ' Dim cmd As SqlCommand New SqlCommand qry sqlConnection cmd CommandType CommandType Text Dim sqlDataReader As SqlDataReader cmd ExecuteReader D Implement this code to return the data Dim qry As String SELECT FROM Products WHERE DestID DestID Dim cmd As SqlCommand New SqlCommand qry sqlConnection cmd CommandType CommandType Text Dim parm As SqlParameter New SqlParameter DestID dest cmd Parameters Add parm Dim SqlDataReader As SqlDataReader cmd ExecuteReader Answer A Explanation Creating a stored procedure and calling it with a SqlCommand object SqlParameter object and an SqlDataReader would be the fastest way to access this data Incorrect Answers B C D Creating a query string in code would work but is not the fastest way to QUESTION You work as the Web developer at Certkiller com You are writing code for an ASP NET page Your page holds a DataGrid control and a Button control The DataGrid control shows the prices of resources purchased by Certkiller com and the Button control is used to refresh the information displayed within the DataGrid control Currently the DataGrid control is repopulated whenever the page is displayed All data being viewed is accessed via a DataView object within the Session object What should you do next to ensure the fastest possible load time for the page A Enable the DataSource property Call the DataBind method of the DataGrid control in the Click event handler for the Button control B Enable the DataSource property Call the DataBind method of the DataGrid control in the Start event handler for the Session object Update the EnableViewState property of the DataGrid control to false Update the EnableViewState property of the DataGrid control to true Answer C Explanation There are times when it is appropriate to disable view state particularly to improve application performance As in this scenario where we are loading a database request into a server control set this property to false If you do not processor time will be wasted loading view state into the server control that will only be overridden by the database query Reference NET Framework Class Library Control EnableViewState Property Visual Basic Incorrect Answers A B D We disable the ViewState to improve performance ViewState is enabled by default QUESTION You work as the Web developer at Certkiller com You are writing code for an ASP NET page Your page holds a CheckBoxList control The CheckBoxList control contains various destinations and is associated with a database that stores all destinations Each destination is rated based on attractiveness and previous customer feedback You plan to change the page so that destinations are listed based on the ratings You define your list and set three columns The higher rated destinations must be listed first with the poorly rated destinations must be listed last All higher rated destinations must be exhibited on the top row of the check box list at run time Choose the property setting which you should use for the CheckBoxList control Change the RepeatDirection property to Vertical Change the RepeatDirection property to Horizontal Change the RepeatLayout property to Flow Change the RepeatLayout property to Table Answer B Explanation The DataList RepeatDirection property is used to get or select whether the DataList control displays vertically or horizontally If this property is set to RepeatDirection Horizontal the items in the list are displayed in rows loaded from left to right then top to bottom until all items are rendered Reference NET Framework Class Library DataList RepeatDirection Property Visual Basic NET Framework Class Library DataList RepeatLayout Property Visual Basic Incorrect Answers A If the DataList RepeatDirection property is set to RepeatDirection Vertical the items in the list are displayed in columns loaded from top to bottom then left to right until all items are rendered C D DataList RepeatLayout Property gets or sets whether the control is displayed in a table or flow layout It does not affect the order in which the items are displayed QUESTION You work as the Web developer at Certkiller com You are writing code for an ASP NET page which will be used to pass vouchers for various gyms to users A user must first specify a country and then choose a city from a list of cities in their designated country After this the names and street addresses of gyms in their city will be shown to the user The list of countries cities and gym names and addresses are stored in a database table You want to reduce the time it takes to retrieve and display the list of gym names after a user chooses the country and city What should you do next Change the connection string to add the packet size property and set its values to Add this directive to your page OutputCache VaryByParam city Add this directive to your page OutputCache VaryByControl country city Change the connection string to maintain your database's connection pool as small as possible Answer B Explanation You can vary user control output to the cache by specifying the user control name and the parameter We use the VaryByParam attribute of the OutputCache Reference NET Framework Developer's Guide Caching Multiple Versions of a User Control Based on Parameters Visual Basic Incorrect Answers A The Packet Size property of the Connection string is the size in bytes of the network packets used to communicate with an instance of data provider It is not an optimal property to change to optimize data retrieval The company database does not seem to include a region column If we keep the connection pool small we would allow less simulation connections However this would not minimize the required to retrieve and display the data QUESTION You work as the Web developer at Certkiller com You are writing code for an ASP NET application named Certkiller App Certkiller App will be used to track employee attendance at the company premises All employees must use Certkiller App to indicate whether they are in-office or out-ofoffice The primary page of the Certkiller App contains a Repeater control named employeeStatus employeeStatus is bound to the results of a procedure in the back-end database This procedure returns information on the staff numbers and names of employees and specifies whether an employee is in-office or out-of-office The code of for employeeStatus is shown here asp repeater id employeeStatus runat server ItemTemplate Container DataItem EmployeeName Container DataItem Status br ItemTemplate asp repeater The code-behind file for your page holds a private procedure named ChangeInOutStatus ChangeInOutStatus changes the status for an employee by using the ID number of the employee You want add a button for each employee listed by employeeStatus so that when an employee clicks it ChangeInOutStatus is called and the employee ID is passed to change the status for the specific employee Choose the two possible actions which you can use to achieve this goal Each answer presents a complete solution to achieveing your goal A Include this HTML code in the ItemTemplate element of employeeStatus input type button id changeStatusButton alt Container DataItem EmployeeID OnClick changeStatusButton Runat server Value Change Status Include this subroutine in the code-behind file for your page Public Sub changeStatusButton ByVal sender As System Object ByVal e As System EventArgs ChangeInOutStatus CInt sender Attributes alt End Sub Include this HTML code in the ItemTemplate element of employeeStatus input type button id changeStatusButton alt Container DataItem EmployeeID OnServerClick changeStatusButton Runat server Value Change Status Include this subroutine in the code-behind file for your page Public Sub changeStatusButton ByVal sender As System Object ByVal e As System EventArgs ChangeInOutStatus CInt sender Attributes alt End Sub Include this HTML code in the ItemTemplate element of employeeStatus asp Button id changeStatusButton Runat server Text Change Status CommandArgument Container DataItem EmployeeID Include this HTML code in the ItemCommand event of employeeStatus If source id changeStatusButton Then ChangeInOutStatus CInt e CommandSource CommandArgument End If Include this HTML code in the ItemTemplate element of employeeStatus asp Button id changeStatusButton Runat server Text Change Status CommandArgument Container DataItem EmployeeID Include this HTML code in the ItemCommand event of employeeStatus If e CommandSource id changeStatusButton Then ChangeInOutStatus CInt e CommandArgument End If Answer B D Explanation B The ServerClick event is raised when the HtmlButton control is clicked This event causes a roundtrip to occur from the client to the server and back It is deliberately different from the clientside OnClick event In the event that a conflict exists between code run with a ServerClick event and code run by a client-side OnClick event the server-side event instructions will override the client-side code D The CommandSource property is used to determine the source of the command Reference NET Framework Class Library HtmlButton OnServerClick Method Visual Basic QUESTION You work as the Web developer at Certkiller com You are writing code for an ASP NET application named Certkiller Certkiller will be used to store and display information on merchandise offered by Certkiller com Certkiller uses a SQL database Your ASP NET page contains two DropDownList controls The Merchandise drop-down list box is used to exhibit merchandise information and the Class drop-down list box is used to exhibit class information The open SqlConnection object you use is named con To populate the drop-down list by binding the SqlDataReader the code listed here is used Line numbers are only shown for reference purposes Dim cmd as New SqlCommand SELECT FROM Merchandise con Dim dr as SqlDataReader dr cmd ExecuteReader Merchandise DataTextField MerchandiseName Merchandise DataValueField MerchandiseID Merchandise DataSource CK Merchandise DataBind Dim dr as SqlDataReader cmd CommandText SELECT FROM Class dr cmd ExecuteReader Class DataTextField ClassName Class DataValueField ClassID Class DataSource CK Class DataBind When you test your configuration the page raises an invalid operation exception What should you do next to ensure that the page successfully Substitute the code for line of the code segment with this code CK ExecuteReader CommandBehavior CloseConnection Include this code between line and line of the code segment ckl Close Substitute the code for line and line of the code segment with this code Dim cmd as New SqlCommand SELECT FROM Class con CK cmd ExecuteReader Delete the code for line of the code segment Replace the code for line of the code segment with this code Page DataBind Answer B Explanation You must explicitly call the Close method when you are through using the SqlDataReader to use the associated SqlConnection for any other purpose Reference NET Framework Class Library SqlDataReader Close Method Visual Basic QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application Certkiller com uses a XML Web service that retrieves a list of encyclopedia articles that hold requested keywords What should you do next to create a class that calls the XML Web service Choose Add Web Service from the Project menu in Visual Studio NET and tthen browse to the XML Web service Choose Add Reference from the Project menu in Visual Studio NET and then browse to the XML Web service Choose Add Web Reference from the Project menu in Visual Studio NET and then browse to the XML Web service Run the Type Library Importer Tlbimp exe and specify the URL for the XML Web service Run the Web Services Discover tool Disco exe and specify the URL for the XML Web service Answer C Explanation You can add a Web reference to projects that use XML Web services that are published on the Internet or on your local Web servers To add a Web reference to a project In Solution Explorer select a project that supports adding Web references On the Project menu choose Add Web Reference In the Add Web Reference dialog box type the URL for the XML Web service in the Address text box and then choose the Arrow Icon Verify that the items in the Available References box are the items you want to reference in your project and then choose Add Reference In Solution Explorer expand the Web References folder to note the namespace for the Web reference classes that are available to the items in your project Reference Visual Studio Adding and Removing Web References Incorrect Answers A B We should use the Add Web reference command not Add Web Service or Add Reference D The Type Library Importer converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly E The Web Services Discovery tool discovers the URLs of XML Web services located on a Web server and saves documents related to each XML Web service on a local disk QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application named Certkiller App Certkiller App will be used by customers to manage their vehicle insurance premiums The PolicyCKLibrary dll written in Visual Basic is the COM component which stores the code for calculating renewal premiums The class named cPolicyActions calculates the premium values cPolicyActions includes a CalculateRenewal function that takes the policy identification number and returns a premium as a Double You must use PolicyCKLibrary dll in Certkiller App Certkiller App must be configured to use the cPolicyActions class How will you accomplish the task A Run this command in a command window TLBIMP EXE PolicyLibrary DLL out PolicyCKLibrary NET DLL Move the original PolicyLibrary dll to the bin directory of Certkiller App B Run this command in a command window TLBEXP EXE PolicyLibrary DLL out PolicyCKLibrary NET DLL Move the original PolicyLibrary dll to the bin directory of Certkiller App Choose Add Existing Item from the Project menu in Visual Studio NET and then browse to PolicyCKLibrary dll Choose Add Reference from the Project menu in Visual Studio NET Then click the COM tab and browse to PolicyCKLibrary dll Answer D Explanation To add a reference to a COM object from a NET application Open a new or existing Microsoft Visual C NET project in Visual Studio NET Click the Project menu and select Add Reference In the Add Reference window click the COM tab Scroll down the list of components and select the one you want to reference such as Microsoft CDO For Exchange Library Click Select After the component name appears in the Selected Components window click OK Note The COM component must have been previously registered on the server for this to succeed Reference Using COM Interoperability in Visual Basic NET Incorrect Answers A TBLIMP is required if Visual Studio NET macros must reference COM components TLBIMP wraps the component enabling Visual Studio NET macros to reference it However TLBIMP is not required if we are going to reference a COM object from a Visual Studio NET application B Tlbexp exe generates a type library that contains definitions of the types defined in the assembly Applications such as Visual Basic can use the generated type library to bind to the NET types defined in the assembly However the requirement of this scenario is the opposite we want to reference a COM object from a Visual Studio NET application C We must specify that we are referencing a COM object QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application named Certkiller App Certkiller App will be used by the Vehicle Purchases department's employees to produce all the required documentation for processing a new vehicle purchase transaction The Certkiller com Bank contains a component written in Visual Basic NET which determines the precise forms to be generated The criterion specified by the employee is used as a basis for generating the correct documentation The name of the component namespace is Certkiller Finance and the name of the class is Closing You define a new ASP NET page named VehiclePurchase aspx and add a reference to the assembly that contains the Certkiller Finance namespace The code of the code-behind file for VehiclePurchase aspx is as follows Imports Certkiller Finance You define a method to the code-behind file to instantiate the Closing class Choose the code below which should be configured for the method to instantiate the class Dim myClosing As New Closing Dim myClosing As Closing closing Server CreateObject Closing Dim myClosing As System Object closing Server CreateObject Closing Dim myType As Type Type GetTypeFromProgID Certkiller Finance Closing localhost True Answer A Explanation We simply instantiate an object with the class with the New constructor Note Web Forms pages have code -behind files associated with them These files are created automatically when you create a new Web form They have the same base name as the Web form with the vb or cs filename extension added Incorrect Answers B C The CreateObject function creates and returns a reference to a COM object CreateObject cannot be used to create instances of classes in Visual Basic unless those classes are explicitly exposed as COM components D The Type GetTypeFromProgID method is provided for COM support Program IDs are not used in Microsoft NET Framework because they have been superceded by the concept of namespace QUESTION You work as the Web developer at Certkiller com You develop a new ASP NET application named Certkiller App You configure Certkiller App to display geographical information and to spport localization for users from the United States Milan London Paris and Athens Users can view geographical information by selecting the location from a drop-down list box on the Location aspx page You want to ensure that information is displayed to users based on the language spoken by the specific user What should you do next Create a database table named Locations and add three columns named LocationID LocaleID and Description respectively Use SqlCommand ExecuteReader to query the table for the locale specified in the user's request Based on the locale specified in the request translate the text by using the TextInfo OEMCodePage property and then populate the drop-down list box with the newly translated text Create a DataTable object named Locations Populate the Locations DataTable object by using string constants Based on the locale specified in the request translate the test by using a UnicodeEncoding object and then bind the DataSource property of the drop-down list box to the DataTable object C Create a database table named Locations and add two columns named LocationID and Description respectively Use a SqlDataAdapter to populate the location information into a DataSet object Based on the locale specified in the request use the String format provider to translate the text and then bind the DataSource property of the drop-down list box to the DataSet DefaultView object D Create string resources assemblies for each locale and then based on the locale specified in the request use a ResourceManager to load the appropriate assembly Populate an array with the string values from the assembly and then bind the DataSource property of the drop-down list box to the array Answer D Explanation The ResourceManager class provides convenient access to culture-correct resources at run time Reference NET Framework Tutorials ResourceManager QUESTION You work as the Web developer at Certkiller com Certkiller com has its headquarters in Chicago and a branch office in New Zealand You develop a new ASP NET application named Certkiller App You configure Certkiller App to display company news and policy information to employees located at the New Zealand branch office The Default aspx page contains a Web Form label control named currentDateLabel The following code is specified in the Page Load event handler for Default aspx currentDateLabel Text DateTime Now ToString D You want to ensure that the date information is displayed correctly for the New Zealand branch office employees How will you accomplish the task In the Web config file for Certkiller App configure the culture attribute of the globalization element as en-NZ In the Web config file for Certkiller App configure the uiCulture attribute of the globalization element as en-NZ In Visual Studio NET configure the responseEncoding attribute in the page directive as Default aspx to UTF- In Visual Studio NET save the Default aspx page for each version of Certkiller App by choosing Advanced Save Options from the File menu and then selecting UTF- Answer A Explanation The culture attribute of the globalization element specifies the default culture for processing incoming Web requests Reference NET Framework General Reference globalization Element Incorrect Answers B The uiculture attribute of the globalization specifies the default culture for processing localedependent resource searches It does not apply in this scenario C D The UTF Encoding Class encodes Unicode characters using UCS Transformation Format -bit form UTF- This encoding supports all Unicode character values and surrogates However it does not help in displaying data in New Zealand format QUESTION You work as the Web developer at Certkiller com Certkiller com has its headquarters in Chicago and a branch office in Berlin You are currently developing an online stock Web site which will be used by employees at the Chicago and Berlin offices You must ensure that when an employee selects an item of stock the cost of the specific item is shown in the United States currency and in the German currency For each locale the appropriate cost must be exhibited Which code should you use to ensure that the currency is returned in the proper format by using the input parameter Function MyGetDisplayValue value As Double inputRegion As String As String Dim display As String Dim region As RegionInfo region New RegionInfo inputRegion display value ToString C display region CurrencySymbol Return display End Function Function MyGetDisplayValue value As Double inputCulture As String As String Dim display As String Dim Local Format As NumberFormatInfo CType NumberFormatInfo CurrentInfo Clone NumberFormatInfo display value ToString C LocalFormat Return display End Function Function MyGetDisplayValue value As Double inputRegion As String As String Dim display As String Dim region As RegionInfo region New RegionInfo inputRegion display value ToString C display region ISOCurrencySymbol Return display End Function Function MyGetDisplayValue value As Double inputCulture As String As String Dim display As String Dim culture As CultureInfo culture New CultureInfo inputCulture display value ToString C culture Return display End Function Answer D Explanation We create a new CultureInfo object based on the inputCulture parameter We then produce the result with C constant representing the current culture and the new CultureInfo object display value ToString C culture Note The CultureInfo Class contains culture-specific information such as the language country region calendar and cultural conventions associated with a specific culture This class also provides the information required for performing culture-specific operations such as casing formatting dates and numbers and comparing strings Reference NET Framework Developer's Guide Formatting Numeric Data for a Specific Culture Visual Basic Incorrect Answers B The NumberFormatInfo class defines how currency decimal separators and other numeric symbols are formatted and displayed based on culture However we should create a CultureInfo object not a NumberFormatInfo object A C We should use the CultureInfo class not the RegionInfo class Note In contrast to CultureInfo RegionInfo does not represent preferences of the user and does not depend on the user's language or culture QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be available on the company intranet and will be used by users to schedule rooms for meetings Your main page contains a Calendar control which employees must use to specify the date for which to reserve a specific meeting room The code for the Calendar control is as follows asp calendar id WorkDays runat server OnDayRender WorkDays DayRender You must ensure that a message stating Employee Meeting is shown beneath each Friday displayed in the calendar You must also ensure that each weekday of the current month is shown in a green highlight in the calendar You decide to write the configuration which will result in the WorkDays DayRender event handler performing these functions Your code is as follows Sub WorkDays DayRender sender As Object e As DayRenderEventArgs End Sub Choose the code which you should add at line of the event handler A If e Day Data DayOfWeek DayOfWeek Friday Then e Cell Controls Add New LiteralControl Employee Meeting End If If Not e day IsWeekend Then e Cell BackColor System Drawing Color Green End If If e Day Date Day And e Day IsOtherMonth Then e Cell Controls Add New LiteralControl Employee Meeting e Cell BackColor System Drawing Color Green End If If e Day Date Day Then e Cell Controls Add New LiteralControl Employee Meeting End If If Not e Day IsWeekend And Not e Day IsOtherMonth Then e Cell BackColor System Drawing Color Green End If If e Day Date DayOfWeek DayOfWeek Friday Then e Cell Controls Add New LiteralControl Employee Meeting End If If Not e Day IsWeekend And Not e Day IsOtherMonth Then e Cell BackColor System Drawing Color Green End If Answer D Explanation We need two if statements to correctly achieve our goal This statement If e Day Date DayOfWeek DayOfWeek Friday Then e Cell Controls Add New LiteralControl Employee Meeting will allow us to display a message that reads Employee Meeting below every Friday displayed in the calendar While this If Not e Day IsWeekend And Not e Day IsOtherMonth Then e Cell BackColor System Drawing Color Green will find all the weekdays for the current month displayed in the calendar and show then with a yellow highlight Incorrect Answers We should check whether it falls on the next month by using IsOtherMonth We need to check for the day of the week using DayOfWeek We need to check for the day of the week using DayOfWeek QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used by customers to obtain vehicle insurance online The InsuredVehicle aspx page is used to obtain information on the designated vehicle to be insured InsuredVehicle aspx holds a TextBox control named vehicleRegNumber Users must provide the vehicle identification number in vehicleRegNumber Users must then click a button named submitButton to start the vehicle insurance purchasing process Once a user pushes submitButton information is retrieved on the vehicle identification number The page is then refreshed to display the additional information The following HTML tag is specified for vehicleRegNumber asp TextBox id vehicleRegNumber runat server EnableViewState True All valid vehicle identification numbers consist of only uppercase letters and numbers You must configure the code which will change all lowercase letters to uppercase letters Choose the two actions which you can perform to accomplish your task Each correct answer presents a complete solution to accomplishing your task Include this code in the vehicleRegNumber TextChanged event handler for InsuredVehicle aspx vehicleRegNumber Text vehicleRegNumber Text ToUpper Include this code in the submitButton Click event handler for InsuredVehicle aspx vehicleRegNumber Text vehicleRegNumber Text ToUpper Include this code in the Page Init event handler for InsuredVehicle aspx vehicleRegNumber Text vehicleRegNumber Text ToUpper Include this code in the Page Render event handler for InsuredVehicle aspx vehicleRegNumber Text vehicleRegNumber Text ToUpper Answer A B Explanation The TextBox TextChanged event occurs when the content of the text box is changed upon server postback When the user hits the submit button additional information is obtained for the vehicle identification number We must therefore convert the text to upper case Reference NET Framework Class Library Page Members Incorrect Answers The Page Init event only occurs when the server control is initialized which is the first step in its lifecycle This occurs only when the page is loaded The Page class does have a rerender event but it does not have a render event QUESTION You work as the Web developer at Certkiller com You are developing new ASP NET application named Certkiller App Certkiller App will be used by customers to create information portals customized to their specific lines of business Certkiller App stores frequently used text strings in application variables for use by the page in the application You want the application to initialize the frequently used text strings only when the first user accesses the application What should you do next Configure code for the Application OnStart event handler in the Global asax file to set the values of the frequently used text strings Configure code for the Application BeginRequest event handler in the Global asax file to set the values of the frequently used text strings Configure code for thethe Session OnStart event handler in the Global asax file to set the values of the frequently used text strings Configure code in the Page Load event handler for the default application page that sets the values of the frequently used text strings when the IsPostback property of the Page object is defined as False Configure code in the Page Load event handler for the default application page that sets the values of the frequently used text strings when the IsNewSession property of the Session object is defined to True Answer A Explanation The OnStart event only occurs when the first user starts the application Reference NET Framework Class Library ServiceBase Class Visual Basic Incorrect Answers The HttpApplication BeginRequest event occurs as the first event in the HTTP pipeline chain of execution when ASP NET responds to a request This would set the values every time a new session is started D E We should use the OnStart event handler of the application not the Page Load event handler QUESTION You work as the Web developer at Certkiller com You are developing a new DataGrid control named Grid All rows defined in Grid hold purchase information and an Edit command button All fields that contain purchase information are set as read-only labels You decide to perform the configuration which will result in the fields converting to text boxes after a user clicks the Edit command button in any row You write the following event handler for the EditCommand event Line numbers are only provided for reference purposes Sub DoItemEdit sender As Object e As DataGridCommandEventArgs Handles Grid EditCommand End Sub Choose the code segment which should be included at line of the event handler Grid EditItemIndex e Item ItemIndex Grid DataKeyField e Item AccessKey Grid SelectedIndex e Item ItemIndex Grid CurrentPageIndex e Item ItemIndex Answer A Explanation The EditItemIndex property is used to programmatically control which item is being edited Setting this property to an index of an item in the DataGrid control will enable editing controls for that item in the EditCommandColumn Reference NET Framework Class Library DataGrid EditItemIndex Property Visual Basic Incorrect Answers The DataKeyfield is used to get or set the key field in the data source specified by the DataSource property The SelectedIndex property is used to determine the index of the item selected by the user in the DataGrid control The CurrentPageIndex property is used to determine the currently displayed page in the DataGrid control when paging is enabled This property is also used to programmatically control which page is displayed QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used on the online sales site Certkiller App contains a page named SaleVerify aspx SaleVerify aspx shows information on products purchased including the quantity and unit price of each product The final purchase total is shown the bottom of the page SaleVerify aspx contains a Web Form that has a Web server control button for submission This control contains the following HTML element generate by Visual Studio NET asp button id submitSalesButton runat server Text Submit Order asp button The main event handler for submitSalesButton is named submitSalesButton Click and runs at the server A client-end function named verifyBeforeSubmit shows a dialog box that requires the user to verify submission of a request What should you do next to ensure that verifyBeforeSubmit runs prior to submitSalesButton Click Change the HTML element as follows asp button id submitSalesButton runat server Text Submit Sale onClick verifyBeforeSubmit asp button Change the HTML elements as follows asp button id submitSalesButton runat server Text Submit Sale ServerClick verifyBeforeSubmit asp button Include the following code to the Page Load event handler for SaleVerify aspx submitSalesButton Attribute Add onclick verifyBeforeSubmit Include the following code to the Page Load event handler for SaleVerify aspx submitSalesButton Attribute Add ServerClick verifyBeforeSubmit Answer C Explanation The proposed solution demonstrates how to specify and code an event handler for the Click event in order to display a simple message on the Web page Reference NET Framework Class Library Button OnClick Method Visual Basic Incorrect Answers The OnClick property of the button control is for server side procedures not client side ones not A QUESTION You work as the Web developer at Certkiller com You are developing a new Web Form for employees of Certkiller com Employees will use the Web Form to update employee information Each instance of the control on your Web Form stores information on a specific employee You create a Web user control named Employee to enable this and place the control on the Web Form You name the control Employee You then include the Employee control to the ItemTemplate of a Repeater control The Repeater control is named repeaterEmployees Each Employee control in repeaterEmployees consists of a number of TextBox controls You want to use an event handler that can deal with TextChanged events which are raised by the TextBox controls Choose the event handler which you should use to accomplish your task Private Sub Employee TextChanged ByVal sender as Object ByVal e as EventArgs Handles Employee TextChanged Private Sub repeaterEmployees ItemDataBound ByVal sender as Object ByVal e as RepeaterItemEventArgs Handles repeaterEmployees ItemDataBound Private Sub repeaterEmployees DataBinding ByVal sender as Object ByVal e as RepeaterItemEventArgs Handles repeaterEmployees DataBinding Private Sub repeaterEmployees ItemCommand ByVal source as Object ByVal e as RepeaterCommandEventArgs Handles repeaterEmployees ItemCommand Answer D Explanation To handle the events we must supply the event publisher information which is the ItemCommand event of the repeaterEmployees repeaterEmployees ItemCommand Incorrect Answers Use TextChanged when the text of the Employee's control itself changes ItemDataBound will not handle TextChanged events that are raised by these TextBox controls DataBinding handles data binding events only QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used by customers to obtain vehicle insurance online The VehicleInfo aspx page contains this Page directive Page Language VB CodeBehind VehicleInfo aspx vb AutoEventWireup false inherits InsApp VehicleInfo The VehicleInfo aspx page contains a TextBox control named vehicleRegNumber Users insert the vehicle identification number of a vehicle in vehicleIDNumber The HTML code for vehicleRegNumber is asp TextBox ID vehicleRegNumber Columns Runat server You want to use an event handler to retrieve information on a vehicle via an XML Web service which charges for each access Once the information is retrieved the page must be refreshed to display the additional information To accommodate this function you decide to implement a TextChanged event handler for vehicleRegNumber Choose the two actions which you should perform when implementing the TextChanged event handler Each correct answer presents only part of the complete solution In the Page directive for VehicleInfo aspx set the AutoEventWireup attributes to true In the Page directive for VehicleInfo aspx set the EnableViewState attribute to true In the vehicleRegNumber HTML element set the AutoPostback attribute to false Add code for the client-side onserverchange event to pass the Web Form for processing by the server D In the vehicleRegNumber HTML element set the AutoPostback attribute to true Add code in the TextChanged event handler to query the XML Web service Answer B D Explanation The Page EnableViewState property value indicates whether the page maintains its view state and the view state of any server controls it contains when the current page request ends The AutoPostBack property is used to specify whether an automatic postback to the server will occur whenever the user changes the content of the text box As we want we want to use an XML Web service we must set the attribute to true Reference NET Framework Class Library Control EnableViewState Property Visual Basic NET Framework Class Library TextBox AutoPostBack Property Visual Basic Incorrect Answers AutoEventWireup is used to automatically associate page events and methods It does not provide a solution for this scenario We are required to use a XML Web service The AutoPostback attribute must be set to false QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application that contains a page named Collections aspx Your ASP NET application uses a Microsoft SQL Server database Collections aspx will be used in the Finance department and contains a DataGrid control named AgedCollections AgedCollections is used to show collections aging information The HTML code for AgedCollections is asp DataGrid id AgedCollections Runat server AutoGenerateColumns True asp DataGrid A Page Load event handler is implemented for Collections aspx AgedCollections is bound by the SQL statement shown here SELECT AccountName TotalAmountDue DaysPastDue FROM tblCollections ORDER BY AccountName You want to modify the display formatting of Collections aspx with the aim of improving how users identify account collections which are overdue by three months All account collections that are older than days must be displayed in green What should you do next Add this code to the ItemDataBound event handler for AgedCollections If CType CType e Item Controls TableCell Text Integer Then CType e Item Controls TableCell ForeColor System Drawing Color Green End If Add this code to the DataBinding event handler for AgedCollections Dim dg As DataGrid dg CType sender DataGrid If CType CType dg Controls TableCell Text Integer Then CType dg Controls TableCell ForeColor System Drawing Color Green End If In the asp DataGrid HTML element for AgedCollections update the AutoGenerate attribute to False Add this HTML code within the open and close tags of AgedCollections Columns asp BoundColumn DataField AccountName asp BoundColumn DataField TotalAmountDue asp BoundColumn DataField DaysPastDue DataFormatString If DataItem Value Then ForeColor System Drawing Color Green Columns In the asp DataGrid HTML element for AgedCollections update the AutoGenerate attribute to False Add this HTML code within the open and close tags of AgedCollections Columns asp BoundColumn DataField AccountName asp BoundColumn DataField TotalAmountDue asp TemplateColumn ItemTemplate DataBinder Eval Container DataItem DaysPastDue If DataItem Value Then ForeColor System Drawing Color Green ItemTemplate asp TemplateColumn Columns Answer A Explanation The ItemDataBound event is raised after an item is data bound to the DataGrid control This event provides you with the last opportunity to access the data item before it is displayed on the client We add code to the event handler for this event which displays entries older than days in green Reference NET Framework Class Library DataGrid ItemDataBound Event Visual Basic QUESTION You work as the Web developer at Certkiller com You are developing a new Web custom control named Toggle which contains a Button control named toggleButton Users will be able to turn Toggle off and back on You develop an event handler named toggleButton Click which changes the BorderStyle property to indicate if the Button is on or off You decide to configure code for the Toggle class Your code must ensure that when toggleButton is clicked by users all pages that have instances of Toggle are able to process custom event handling code To perform this task you implement this code for the Toggle class Public Event ChangedValue sender As Object e As EventArgs Protected OnChangedValue e As EventArgs RaiseEvent ChangedValue Me e As EventArgs End Sub To complete your code segment you must write code for toggleButton Click to ensure the following Pages that have instances of Toggle must be able to process the ChangedValue event Pages that have instances of Toggle must be able to process custom event handling code Which code should you add to the toggleButton Click Choose two correct answers Each correct answer presents only part of the complete solution AddHandler sender click AddressOfChangedValue AddHandler sender Click AddressOfOnChangedValue OnChangedValue EventArgs Empty ChangedValue Me EventArgs Empty Answer B C Explanation To wire your event handler to the instance you must create an instance of EventHandler that takes a reference to OnChangedValue in its argument and add this delegate instance to the Click event We can invoke the OnChangedValue event We must use only the EventArgs parameter Note To consume an event in an application you must provide an event handler an event-handling method that executes program logic in response to the event and register the event handler with the event source This process is referred to as event wiring Reference C Programmer's Reference Events Tutorial NET Framework Developer's Guide Consuming Events Visual Basic Incorrect Answers A We must use the OnChangedValue event D We should specify only the EventArgs parameter QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used to supply information to customers of the company Half of the information will be presented to customers through images Some customers will be accessing the information by using various browsers that can vocalize the textual content of your Web pages You must ensure that for these specific customers content of the images are obtained in the vocalized form You must configure Certkiller App to ensure that all Certkiller com customers can access it You want to use the minimum amount of development effort What should you do next Change all ASP NET pages in Certkiller App to enable the view state Change all ASP NET pages in Certkiller App to add custom logic that passes the demographic information in either textual or graphical format Change all images in Certkiller App to ensure that the ToolTip property passes the same demographic information as the image Change all images in Certkiller App to ensure that the AlternateText property passes the same demographic information as the image Answer D Explanation The AlternateText property is used by accessibility utilities such as the Windows XP narrator in order to present graphics as speech QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used to print insurance estimates Your application contains a main page which will be used by users to insert the vehicle identification number This page contains information on all vehicle classes It is this information which will be used to rate the vehicle for insurance purposes The main page contains a TextBox control This TextBox control is used to insert the vehicle identification number You add an event handler that will perform the vehicle information lookup in the database for the change event of the TextBox control You set the AutoPostBack attribute of the TextBox as True When you test your configuration you find that after entering a valid vehicle identification number and using the TAB key to clear from the text box no information is displayed on that specific vehicle You investigate the problem and find that the issue is only relevant on the test computer which you are using No other test computers have the problem What should you do next to ensure that information on the vehicle is displayed after you enter a vehicle identification number Enable Internet Explorer to allow scripting Enable Internet Explorer to allow page transitions In the Page directive change the SmartNavigation attribute to True In the Page directive change the AutoEventWireup attribute to True Answer A Explanation For the AutoPostBack property to work properly the user's browser must be set to allow scripting This is the default in most cases However some users disable scripting for security reasons Reference Visual Basic and Visual C Concepts ASP NET Server Control Event Model QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be published in a number of languages You create a satellite assembly that will contain the localized resources for one of the other languages and that will contain code that accesses Enterprise Services All software applications must be digitally signed with a public private key pair You have access to the private key and not the public key You want to test the localized satellite assembly but to do this you need to digitally sign the assembly What should you do next Choose two possible solutions Each correct answer presents a complete solution for accomplishing your task Use the Software Publisher Certificate Test tool Cert spc exe to create a test certificate for the satellite assembly Use the Resource File Generator Resgen exe with the compile switch to compile the satellite assembly Use the Assembly Linker Al exe with the delay switch to compile the satellite assembly Use the Global Assembly Cache tool Gacutil exe to deploy the assembly in the global assembly cache Use the Strong Name tool Sn exe to generate a new public private key pair and then use the new key pair to sign the assembly temporarily for testing purposes Answer C E Explanation C The delay switch specifies whether the assembly will be fully or partially signed When an assembly is delay signed Al exe does not compute and store the signature but just reserves space in the file so the signature can be added later E The Strong Name tool helps sign assemblies with strong names Sn exe provides options for key management signature generation and signature verification The -R and -Rc options are useful with assemblies that have been delay signed In this scenario only the public key has been set at compile time and signing is performed later when the private key is known Reference NET Framework Tools Strong Name Tool Sn exe NET Framework Tools Assembly Linker Al exe NET Framework Tools Software Publisher Certificate Test Tool Cert spc exe Incorrect Answers The Software Publisher Certificate Test tool creates a Software Publisher's Certificate SPC from one or more X certificates Cert spc exe is for test purposes only However there is no need of a SPC since we already have access to the company's public key Resgen is not useful for signing assemblies Note The Resource File Generator converts txt files and resx XML-based resource format files to common language runtime binary resources files that can be embedded in a runtime binary executable or compiled into satellite assemblies D The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache However it cannot be used to digitally sign an assembly QUESTION You work as the Web developer at Certkiller com You are developing a new assembly that will be used by all ASP NET applications on the Web server Your new assembly will access data stored within a relational database You want to enable all ASP NET applications on the Web server to access your new assembly What should you do next to ensure that all ASP NET applications can access the assembly Choose two solutions to achieving your goal Each correct answer presents only part of the complete solution You must run the Assembly Registration tool Regasm exe You must run the Strong Name tool Sn exe You must run the Installer tool Intallutil exe You must run the Global Assembly Cache tool Gacutil exe Answer B D Explanation B The Strong Name tool helps sign assemblies with strong names D There are two ways to install an assembly into the global assembly cache Using Microsoft Windows Installer This is not an option here Using the Global Assembly Cache tool Gacutil exe Reference NET Framework Developer's Guide Working with Assemblies and the Global Assembly Cache NET Framework Developer's Guide Installing an Assembly into the Global Assembly Cache Incorrect Answers A The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry which allows COM clients to create NET Framework classes transparently C The Installer tool allows you to install and uninstall server resources by executing the installer components in a specified assembly QUESTION You work as the Web developer at Certkiller com You are developing a new Web site for Certkiller com Your Web site will be used by customers who enter a competition to win flights to other countries The competition consists of three levels of prizes named Bronze Silver and Gold respectively Each proze level has content on the page which pertains to only that specific level The user controls named Bronze ascx Silver ascx and Gold ascx hold the content of each specific level Your page contains a variable named awardLevel You want to ensure that appropriate page is automatically loaded and displayed based on awardLevel's value You also want to minimize the amount of memory resources that will be used by each page Which code must you use in the Page Load event handler to achieve your goal Dim headerControl as UserControl Select Case awardLevel Case Bronze headerControl LoadControl Bronze ascx Case Silver headerControl LoadControl Silver ascx Case Gold headerControl LoadControl Gold ascx End Select Controls Add headerControl Dim headerControl As UserControl Select Case awardLevel Case Bronze headerControl LoadControl Bronze ascx Case Silver headerControl LoadControl Silver ascx Case Gold headerControl LoadControl Gold ascx End Select BronzeHeaderControl Visible False SilverHeaderControl Visible False GoldHeaderControl Visible False Select Case awardLevel Case Bronze BronzeHeaderControl Visible True Case Silver SilverHeaderControl Visible True Case Gold GoldHeaderControl Visible True End Select Dim BronzeHeaderControl As UserControl Dim SilverHeaderControl As UserControl Dim GoldHeaderControl As UserControl BronzeHeaderControl LoadControl Bronze ascx SilverHeaderControl LoadControl Silver ascx GoldHeaderControl LoadControl Gold ascx Select Case awardLevel Case Bronze Controls Add BronzeHeaderControl Case Silver Controls Add SilverHeaderControl Case Gold Controls Add GoldHeaderControl End Select Answer A Explanation The TemplateControl LoadControl method obtains a UserControl object from a user control file Reference NET Framework Class Library TemplateControl LoadControl Method Visual Basic Incorrect Answers We must add the control in order to display it We must load the user controls Loading all three controls increase the demand on the system resoures QUESTION You work as the Web developer at Certkiller com You are developing a new ASP NET application named Certkiller App Certkiller App will be used to sell products online to customers You have received instruction from the CIO to display the name of the company at the top pf each page To comply with this requirement you create a Web custom control to encapsulate the Certkiller com name in a heading element The control class named CompanyName inherits from the Control class You write this HTML code to display the company name h Certkiller com h Which code must you use in the CompanyName class to display the company header Protected Overrides Sub Render ByVal output As System Web UI HtmlTextWriter output Write h Certkiller com h End Sub Protected Overrides Sub OnPreRender ByVal e As System EventArgs Me Controls Add New LiteralControl h Certkiller com h End Sub Protected Overrides Sub RenderChildren writer As System Web UI HtmlTextWriter writer Write h Certkiller com h End Sub Protected Overrides Sub OnInit e As EventArgs Me Controls Add New LiteralControl h Certkiller com h End Sub Answer A Explanation You create a rendered custom control's appearance by overriding the base class's Render method and writing to the method's output argument using the HtmlTextWriter utility methods The most direct approach is to use the Write methods to add the HTML directly to the HtmlTextWriter The Control RenderChildren method outputs the content of a server control's children to a provided HtmlTextWriter object which writes the content to be rendered on the client This method notifies ASP NET to render any Active Server Pages ASP code on the page If no ASP code exists on the page this method renders any child controls for the server control Reference - - Training kit Creating the Rendered Control's Appearance pages - NET Framework Class Library Control RenderChildren Method Visual Basic Incorrect Answers B D We should not add controls to the web page just a header C We should override the render method not the RenderChildren method as we want to add content to the page itself not the controls of the page QUESTION You work as the Web developer at Certkiller com You are developing three new ASP NET applications named Certkiller App Certkiller App and Certkiller App respectively Each one of your applications must use a reusable toolbar that will appear at the top of each page displayed to users The actual content of toolbar will differ based on which option a user selects when creating a profile What should you do next to add the toolbar to the ASP NET toolbox for all developers on the Certkiller com Development team Create a new Web Control Library project and then create the toolbar within a Web custom control Insert a new Web user control in your ASP NET project and then create the toolbar within the Web user control Insert a new Web Form in your ASP NET project configure the toolbar within the Web Form and then save the Web Form by using an ascx extension Insert a new component class in your ASP NET project and then configure the toolbar within the designer of the component class Answer A Explanation Web custom controls are compiled code which makes them easier to use but more difficult to create You can add a Web custom control to the Toolbox and display it in a visual designer with full Properties window support and all the other design-time features of ASP NET server controls Reference Visual Basic and Visual C Concepts Recommendations for Web User Controls vs Web Custom Controls Incorrect Answers Web user controls are easy to make but they can be less convenient to use in advanced scenarios such as this Because Web user controls are compiled dynamically at run time they cannot be added to the Toolbox A Web form would be inadequate The Component class provides the base implementation for the IComponent interface and enables object-sharing between applications It does not fit in this scenario QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET page to retrieve merchandise information from a Microsoft SQL Server database named Certkiller DB You want to show a listing of available merchandise in a Repeater control named repeaterMerchandise You create this procedure to obtain the merchandise information from Certkiller DB Private Sub RepeaterBind ByVal ConnectionString As String ByVal SQL As String Dim da As SqlDataAdapter Dim dt As DataTable da New SqlDataAdapter SQL ConnectionString dt New DataTable You must write the code which will populate repeaterMerchandise with the information obtained from Certkiller DB Choose the code which you should use repeaterMerchandise DataSource dt repeaterMerchandise DataBind da Fill dt da Fill dt repeaterMerchandise DataBind repeaterMerchandise DataSource dt repeaterMerchandise DataBind da Fill dt repeaterMerchandise DataSource dt da Fill dt repeaterMerchandise DataSource dt repeaterMerchandise DataBind Answer D Explanation First we must fill the data set Then we specify the data source and finally we bind the data to the control Note Using data-access objects in code follows the sequence Create the data connection object Create a data adapter object Create a data set object Invoke methods on the adapter object to fill or update the data set This scenario da Fill dt Use data binding or another technique to display the data from the data set This scenario repeaterMerchandise DataSource dt repeaterMerchandise DataBind Reference - - Training kit Creating a Database Connection at Run Time pages - Incorrect Answers A We must start by filling the data set We must specify the data source before we bind the control to the data We must start by filling the data set QUESTION You work as the Web developer at Certkiller com You configure a new ASP NET application named Certkiller App Certkiller App will be used by customers to place new orders to purchase goods and services offered by the company All customer orders reside in a Microsoft SQL Server database table named Certkiller DB Certkiller DB contains an IDENTITY column named PurchaseID The code you write uses a DataTable object which contains a column named PurchaseNo to manage the purchase information A stored procedure inserts each new purchase placed into Certkiller DB and uses a parameter to return the new PurchaseID value for each purchase that is placed The Update method of a SqlDataAdapter object calls the stored procedure You designate a SqlCommand object to the InsertCommand property of the SqlDataAdapter object and then add a SqlParameter object to the Parameters collection of the SqlDataAdapter object You define the name and data type of the parameter You must configure the SqlParameter object' properties to retrieve the new PurchaseID values from Certkiller DB into the PurchaseNo column of the DataTable object How will you accomplish the task Configure the Direction property as ParameterDirection ReturnValue Configure the SourceColumn property as Purchase ID Configure the Direction property as ParameterDirection ReturnValue Configure the SourceColumn property as Purchase No Configure the Direction property as ParameterDirection Output Configure the SourceColumn property as Purchase ID Configure the Direction property as ParameterDirection Output Configure the SourceColumn property as Purchase No Answer D Explanation As the stored procedure uses a parameter to return the new Purchase ID value we need to use an output paramater This is accomplished by setting the Direction property to ParameterDirection Output The SqlParameter SourceColumn property gets or sets the name of the source column that is mapped to the DataSet and used for loading or returning the Value The source column where the value will be stored is the Purchase Number column Note SqlParameter Direction property gets or sets a value indicating whether the parameter is input-only output-only bidirectional or a stored procedure return value parameter Reference NET Framework Class Library SqlParameter Direction Property Visual Basic NET Framework Class Library ParameterDirection Enumeration NET Framework Class Library SqlParameter SourceColumn Property Incorrect Answers A B The scenario clearly states that the stored procedure uses a parameter not a return value to return the new Purchase ID value We should not set the Direction property to ParameterDirection ReturnValue C The output parameter should be stored in the Purchase Number column We must set the SourceColumn property to the Purchase Number column QUESTION You work as the Web developer at Certkiller com You create a new ASP NET page which users will use to provide proposals for names for new goods developed by Certkiller com Users can specify numerous names for one product Each name proposed is stored in a Microsoft SQL Server database which contains a table containing a UserID column a GoodsID column and a Proposal column A user must log on by providing a UseID and password in order to insert a proposal on your page After logging on to the page the user selects a GoodsID from a drop-down list box and then specifies his proposals by using a grid The Microsoft SQL Server database table contains a unique index that contains the UserID GoodsID and Proposal columns This unique index only allows the same proposed name to be recorded once for the same product by the same user You use SqlDataAdapter object to add all proposals into the database You discover that when a proposed name for a product is duplicated an error is returned You want to avoid this type of error from occurring but you want to be able to access all suggested names that were skipped because of errors You want to ensure though that all remaining proposals inserted by a user are added to the database How will you accomplish these tasks Change the SqlDataAdapter object's ContinueUpdateOnError property to True prior to calling the object's Update method Enclose the call to the SqlDataAdapter object's Update method in a try catch block In the Catch code configure the object's ContinueUpdateOnError property as True C Set an event handler for the RowUpdated event of the SqlDataAdapter object In the event handler when the SqlRowUpdatedEventArgs object's UpdateStatus property has a value of UpdateStatus ErrorsOccured set the SqlDataAdapter object's ContinueUpdateOnErrorProperty to True D Set an event handler for the RowUpdated event of the SqlDataAdapter object In the event handler when the SqlRowUpdatedEventArgs object's Errors property returns a non-null value set the SqlDataAdapter object's ContinueUpdateOnError property to True Answer A Explanation The SqlDataAdapter ContinueUpdateOnError property gets or sets a value that specifies whether to generate an exception or the row in error when an error is encountered during a row update If ContinueUpdateOnError is set to true no exception is thrown when an error occurs during the update of a row The update of the row is skipped and the error information is placed in the RowError property of the row in error Reference NET Framework Class Library SqlDataAdapter Members Incorrect Answers B We should set the ContinueUpdateOnError property to true beforehand not the Catch code C D An event handler is not needed The required functionality is inherent in the SqlDataAdapter class QUESTION You work as the Web developer at Certkiller com You create a new ASP NET application named Certkiller App Multiple users will use Certkiller App simultaneously to print reports A Microsoft SQL Server database contains all data used by Certkiller App You decide to optimize the response time of Certkiller App when more than one user is retrieving data to print reports To do this you create a procedure to obtain the data from the database and you store a valid connection string in a variable named connString in it Which code segment must you use to add code to the procedure to connect to the database Dim cnn As New OleDb OleDbConnection connString Dim cnn As New SqlClient SqlConnection connString Dim cnn As New ADODB Connection Dim cnn As New SQLDMO Database Answer B Explanation We use SqlConnections to connect to SQL Server with Version and later Reference NET Framework Developer's Guide NET Data Providers Visual Basic Incorrect Answers A For SQL Server and later we should use a SQLConnection not an OleDBConnection for highest efficiency C D ADODB and SQLDMO are legacy formats which should be avoided QUESTION You work as the Web developer at Certkiller com You create a new ASP NET page Users will use your page to obtain information on customer purchases Users must first select a customer's name to display specific information on that customer A Microsoft SQL Server database currently stores all customer information You define a stored procedure to return the data from the database and display it on your page All orders for products which a customer has not yet received and all current sales of the customer are returned as a result set of the stored procedure All current purchases of a customer is returned in a parameter named purchases You configure code to run the stored procedure and return data on a selected customer The stored procedure uses a SqlCommand object named cmd and a SqlDataReader object named reader You proceed to bind reader to a DataGrid control on the ASP NET page to list all orders which were not dispatched You want customer purchase information to be shown a Label control named purchasesLabel Choose the code segment that will achieve your goals A reader NextResult purchasesLabel Text cmd Parameters purchases Value ToString reader Close B reader Close purchasesLabel Text reader NextResult ToString C reader Close purchasesLabel Text cmd Parameters purchases Value ToString D purchasesLabel Text cmd Parameters RETURN VALUE Value ToString reader Close Answer C Explanation The purchases parameter is an output parameter that contains the information we want to display in the Label control We fetch this value from the parameters collection convert it to a string and save it the label control Reference NET Framework Developer's Guide Input and Output Parameters and Return Values Visual Basic Incorrect Answers A B The SqlDataReader NextResult method advances the data reader to the next result when reading the results of batch Transact-SQL statements However in this scenario the reader only provides a single result set D Purchase information is returned in a parameter named purchases It is not returned as a return value of the stored procedure QUESTION You work as the Web developer at Certkiller com You create a new ASP NET page Your ASP NET page will exhibit stock information on selected products The code you have written will create ad hoc SQL queries and then retrieve information from a Microsoft SQL Server database named Certkiller DB A variable named SQL contains the SQL statement for the SQL query A string variable named StockID contains the identification number of a product To define the SQL query you use this code SQL SELECT UnitsOnHand UnitsOnOrder FROM Inventory WHERE ProductID StockID You use the SqlDataReader object named reader to retrieve the stock data and all columns that you use are of type int Choose the line of code you should use to assign the UnitsOnHand quantity to a variable named CKHand CKHand reader GetInt CKHand reader GetInt CKHand reader GetInt CKHand reader GetInt Answer C Explanation The SQL Server datatype int corresponds to -bit Visual Basic NET integers We must therefore use the GetInt method which gets the value of the specified column as a -bit signed integer We must specify the st column as we want to retrieve the value of the UnitsOnHand column which is listed first in the SQL SELECT statement The GetInt parameter which specifies the ordinal of the column is based We should use value of the parameter to retrieve the appropriate column Note The SQL Server datatype int Integer whole number represents

Related Downloads
Explore
Post your homework questions and get free online help from our incredible volunteers
  1115 People Browsing
 116 Signed Up Today
Your Opinion
Which country would you like to visit for its food?
Votes: 204