Top Posters
Since Sunday
5
a
5
k
5
c
5
B
5
l
5
C
4
s
4
a
4
t
4
i
4
r
4
A free membership is required to access uploaded content. Login or Register.

Developing Windows-based Applications.docx

Uploaded: 6 years ago
Contributor: redsmile
Category: Operating Systems
Type: Other
Rating: N/A
Helpful
Unhelpful
Filename:   Developing Windows-based Applications.docx (402.41 kB)
Page Count: 203
Credit Cost: 1
Views: 105
Last Download: N/A
Transcript
Microsoft - Developing Windows-based Applications QUESTION You create a Windows Form named Certkiller Form The form enables users to maintain database records in a table named Certkiller You need to add several pairs of controls to Certkiller Form You must fulfill the following requirements Each pair of controls must represent one column in the Certkiller table Each pair must consist of a TextBox control and a Label control The LostFocus event of each TextBox control must call a procedure named UpdateDatabase Additional forms similar to Certkiller Form must be created for other tables in the database Application performance must be optimized The amount of necessary code must be minimized What should you do A Create and select a TextBox control and a Label control Write the appropriate code in the LostFocus event of the TextBox control Repeatedly copy and paste the controls into Certkiller Form until every column in the Certkiller table has a pair of controls Repeat this process for the other forms B Add a TextBox control and a Label controls to Certkiller Form Write the appropriate code in the LostFocus event of the TextBox control Create a control array form the TextBox control and the Label control At run time add additional pairs of controls to the control array until every column in the Certkiller table has a pair of controls Repeat this process for the other forms Create a new user control that includes a TextBox control and a Label control Write the appropriate code in the LostFocus event of the TextBox control For each column in the Certkiller table add one instance of the user control to the Certkiller Form Repeat this process for the other forms Create a new ActiveX control that includes a TextBox control and a Label control For each column in the Certkiller table add one instance of the ActiveX control to Certkiller Form Repeat this process for the other forms Answer C Explanation We combine multiple Windows Form controls into a single control called user control This is the most efficient solution to reuse functionality in this scenario Note Sometimes a single control does not contain all of the functionality you need For instance you might want a control that you can bind to a data source to display a first name last name and phone number each in a separate TextBox Although it is possible to implement this logic on the form itself it might be more efficient to create a single control that contains multiple text boxes especially if this configuration is needed in many different applications Controls that contain multiple Windows Forms controls bound together as a single unit are called user controls Reference - - Training kit Inheriting from UserControl Page Incorrect Answers Only the controls not the code of the control will be copied This is not the best solution With a user control we could avoid writing code that are executed at run time ActiveX controls should be avoided in Visual Studio NET They are less efficient QUESTION You use Visual Studio NET to create a Windows-based application The application captures screen shots of a small portion of the visible screen You create a form named Certkiller CameraForm You set the Certkiller CameraForm BackColor property to Blue You create a button on the form to enable users to take a screen shot Now you need to create a transparent portion of Certkiller CameraForm to frame a small portion of the screen Your application will capture an image of the screen inside the transparent area The resulting appearance of CertK i ngCameraForm is shown in the exhibit You add a Panel control to Certkiller CameraForm and name it transparentPanel You must ensure that any underlying applications will be visible within the panel Which two actions should you take Each correct answer presents part of the solution Choose two Set transparentPanel BackColor to Red Set transparentPanel BackColor to Blue Set transparentPanel BackgroundImage to None Set transparentPanel Visible to False Set Certkiller CameraForm Opacity to Set Certkiller CameraForm TransparencyKey to Red Set Certkiller CameraForm TransparencyKey to Blue Answer A F Explanation A We set the Background color of the Panel to Red F We then the transparency color of the Form to Red as well This will make only the Panel transparent since the background color of the form is Blue QUESTION You use Visual Studio NET to create a Windows-based application The application includes a form named Certkiller Form Certkiller Form contains controls that enable users to set basic configuration options for the application You design these controls to dynamically adjust when users resize Certkiller Form The controls automatically update their size and position on the form as the form is resized The initial size of the form should be x pixels If ConfigurationForm is resized to be smaller than x pixels the controls will not be displayed correctly You must ensure that users cannot resize ConfigurationForm to be smaller than x pixels Which two actions should you take to configure Certkiller Form Each correct answer presents part of the solution Choose two Set the MinimumSize property to Set the MinimumSize property to Set the MinimizeBox property to True Set the MaximumSize property to Set the MaximumSize property to Set the MaximumBox property to True Set the Size property to Set the Size property to Answer A H Explanation A The Form MinimumSize Property gets or sets the minimum size the form can be resized to It should be set to H We use the size property to set the initial size of the form The initial size should be set to Reference NET Framework Class Library Form MinimumSize Property C NET Framework Class Library Form Size Property C Incorrect Answers The initial size is x The minimal size should be set to The minimize button will be displayed but it will not affect the size of the form D E There is no requirement to define a maximum size of the form The maximize button will be displayed but it will not affect the size of the form The initial size should be x not x QUESTION You use Visual Studio NET to create a Windows-based application The application includes a form named CertK Form which displays statistical date in graph format You use a custom graphing control that does not support resizing You must ensure that users cannot resize minimize or maximize CertK Form Which three actions should you take Each answer presents part of the solution Choose three Set CertK Form MinimizeBox to False Set CertK Form MaximizeBox to False Set CertK Form ControlBox to False Set CertK Form ImeMode to Disabled Set CertK Form WindowState to Maximized Set CertK Form FormBorderStyle to one of the Fixed Styles Set CertK Form GridSize to the appropriate size Answer A B F Explanation We disable the Minimize and Maximize buttons with the CertK Form Minimizebox and the CertK Form Maximizebox properties Furthermore we should use a fixed FormBorderStyle to prevent the users from manually resizing the form Reference Visual Basic and Visual C Concepts Changing the Borders of Windows Forms NET Framework Class Library Form MinimizeBox Property C NET Framework Class Library Form MaximizeBox Property C QUESTION You use Visual Studio NET to create a Windows-based application for Certkiller Inc The application includes a form that contains several controls including a button named exitButton After you finish designing the form you select all controls and then select Lock Controls from the Format menu Later you discover that exitButton is too small You need to enlarge its vertical dimension with the least possible effort and without disrupting the other controls First you select exitButton in the Windows Forms Designer What should you do next A Set the Locked property to False Set the Size property to the required size Set the Locked property to True Set the Locked property to False Use the mouse to resize the control Set the Locked property to True Set the Size property to the required size Use the mouse to resize the control Answer C QUESTION You develop a Windows control named FormattedTextBox which will be used by many developers in your company Certkiller Inc FormattedTextBox will be updated frequently You create a custom bitmap image named CustomControl bmp to represent FormattedTextBox in the Visual Studio NET toolbox The bitmap contains the current version number of the control and it will be updated each time the control is updated The bitmap will be stored in the application folder If the bitmap is not available the standard TextBox control bitmap must be displayed instead Which class attribute should you add to FormattedTextBox ToolboxBitmap typeof TextBox class FormattedTextBox ToolboxBitmap CustomControl bmp class FormattedTextBox ToolboxBitmap typeof TextBox CustomControl bmp class FormattedTextBox ToolboxBitmap typeof TextBox ToolboxBitmap CustomControl bmp class FormattedTextBox Answer B Explanation You specify a Toolbox bitmap by using the ToolboxBitmapAttribute class The ToolboxBitmapAttribute is used to specify the file that contains the bitmap Reference - - Training kit To provide a Toolbox bitmap for your control Page - Incorrect Answers A C D If you specify a Type type your control will have the same Toolbox bitmap as that of the Type type you specify QUESTION You use Visual Studio NET to develop a Windows-based application that contains a single form This form contains a Label control named labelCKValue and a TextBox control named textCKValue labelCKValue displays a caption that identifies the purpose of textCKValue You want to write code that enables users to place focus in textCKValue when they press ALT V This key combination should be identified to users in the display of labelCKValue Which three actions should you take Each correct answer presents part of the solution Choose three Set labelCKValue UseMnemonic to True Set labelCKValue Text to Value Set labelCKValue CausesValidation to True Set textCKValue CausesValidation to True Set textCKValue TabIndex to exactly one number less than labelValue TabIndex Set textCKValue TabIndex to exactly one number more than labelValue TabIndex Set textCKValue Location so that textValue overlaps with labelValue on the screen Add the following code to the Load event of MainForm text value controls Add labelValue Answer A B F Explanation If the UseMnemonic property is set to true A and a mnemonic character a character preceded by the ampersand is defined in the Text property of the Label B pressing ALT the mnemonic character sets the focus to the control that follows the Label in the tab order F You can use this property to provide proper keyboard navigation to the controls on your form Note The UseMnemonic property gets or sets a value indicating whether the control interprets an ampersand character in the control's Text property to be an access key prefix character UseMnemonic is set to True by default Note As a practice verify the answer yourself Reference NET Framework Class Library Label UseMnemonic Property C Incorrect Answers C D The CausesValidation setting has no effect in this scenario E The Text control must tabindex that is the successor to the tabindex of the label control G H This is not necessary It has no effect here QUESTION You use Visual Studio NET to create a Windows-based application called Certkiller Mortage The main form of the application contains several check boxes that correspond to application settings One of the CheckBox controls is named advancedCheckBox The caption for advancedCheckBox is Advanced You must enable users to select or clear this check box by pressing ALT A Which two actions should you take Each correct answer presents part of the solution Choose two Set advancedCheckBox AutoCheck to True Set advancedCheckBox AutoCheck to False Set advancedCheckBox Text to Advanced Set advancedCheckBox Tag to Advanced Set advancedCheckBox CheckState to Unchecked Set advancedCheckBox CheckState to Indeterminate Set advancedCheckBox Apperance to Button Set advancedCheckBox Apperance to Normal Answer A C Explanation The AutoCheck property must be set to True so that the CheckBox automatically is changed when the check box is accessed The Text property contains the text associated with this control By using the -sign we define a shortcut command for this control Advanced defines the shortcut ALT A Reference NET Framework Class Library CheckBox Properties NET Framework Class Library CheckBox AutoCheck Property C Incorrect Answers If AutoCheck is set to false you will need to add code to update the Checked or CheckState values in the Click event handler The Tag property only contains data about the control E F The CheckState property only contains the state of the check box G H The appearance property only determines the appearance of a check box control QUESTION Your company Certkiller uses Visual Studio NET to develop internal applications You create a Windows control that will display custom status bar information Many different developers at Certkiller will use the control to display the same information in many different applications The control must always be displayed at the bottom of the parent form in every application It must always be as wide as the form When the form is resized the control should be resized and repositioned accordingly What should you do Create a property to allow the developers to set the Dock property of the control Set the default value of the property to AnchorStyle Bottom Create a property to allow the developer to set the Anchor property of the control Set the default value of the property to AnchorStyle Bottom Place the following code segment in the UserControl Load event this Dock DockStyle Bottom D Place the following code segment in the UserControl Load event this Anchor AnchorStyle Bottom Answer C Explanation DockStyle Bottom docks the control to the bottom of the form This will force the control to be as wide as to form Furthermore the control will be resized automatically Reference Visual Basic and Visual C Concepts Aligning Your Control to the Edges of Forms NET Framework Class Library AnchorStyles Enumeration C Incorrect Answers There is no need to the other developers to set the Dock property The Dock property should be used D The Anchorstyle class specifies how a control anchors to the edges of its container Not how a control is docked QUESTION As a software developer at Certkiller inc you use Visual Studio NET to create a Windows-based application You need to make the application accessible to users who have low vision These users navigate the interface by using a screen reader which translates information about the controls on the screen into spoken words The screen reader must be able to identify which control currently has focus One of the TextBox controls in your application enables users to enter their names You must ensure that the screen reader identifies this TextBox control by speaking the word name when a user changes focus to this control Which property of this control should you configure Tag Next Name AccessibleName AccessibleRole Answer D Explanation The AccessibleName property is the name that will be reported to the accessibility aids Reference Visual Basic and Visual C Concepts Providing Accessibility Information for Controls on a Windows Form Visual Basic and Visual C Concepts Walkthrough Creating an Accessible Windows Application Incorrect Answers A B C The Tag Next and Name properties of a control is not used directly by accessibility aids E The AccessibleRole property describes the use of the element in the user interface QUESTION You develop a Visual Studio NET application that dynamically adds controls to its form at run time You include the following statement at the top of your file using System windows Forms In addition you create the following code to add Button controls Button tempButton new Button tempButton Text NewButtonCaption tempButton Name NewButtonName tempButton Left NewButtonLeft tempButton Top NewButtonTop this Controls Add tempButton tempButton Click new EventHnadler ButtonHnadler Variables are passed into the routine to supply values for the Text Name Left and Top properties When you compile this code you receive an error message indicating that ButtonHandler is not declared You need to add a ButtonHandler routine to handle the Click event for all dynamically added Button controls Which declaration should you use for ButtonHandler public void ButtonHandler public void ButtonHandler System Windows Forms Button sender public void ButtonHandler System Object sender public void ButtonHandler System Windows Forms Button sender System EventArgs e public void ButtonHandler System Object sender System EventArgs e Answer E QUESTION You develop a Windows-based application that includes the following code segment Line numbers are included for reference only private void Password Validating object sender System ComponentModel CancelEventArgs e if Valid Certkiller Password false Insert new code You must ensure that users cannot move control focus away from textPassword if Valid Certkiller Password returns a value of False You will add the required code on line e Cancel true sender name password AcceptsTab false password CausesValidation false Answer A Explanation If the input in the control does not fall within required parameters the Cancel property within your event handler can be used to cancel the Validating event and return the focus to the control Reference - - Training kit The Validating and Validated Events Page Incorrect Answers Setting an object to an unknown variable is rubbish The AccptsTab property gets or sets a value indicating whether pressing the TAB key in a multiline text box control types a TAB character in the control instead of moving the focus to the next control in the tab order The CausesValidation property gets or sets a value indicating whether validation is performed when the Button control is clicked QUESTION You develop an application that enables users to enter and edit purchase order details The application includes a Windows Form named Display Certkiller Form The application uses a client-side DataSet object to manage data The DataSet object contains a Data Table object named Certkiller Details This object includes one column named Quantity and another named UnitPrice For each item on a purchase order your application must display a line item total in a DataGrid control on Display Certkiller Form The line item is the product of Quantity times UnitPrice Your database design does not allow you to store calculated values in the database You need to add code to your Form Load procedure to calculate and display the line item total Which code segment should you use A DataColumn totalColumn new DataColumn Total Type GetType system Decimal Certkiller Columns Add totalColumn totalColumn Expression Quantity UnitPrice B DataColumn totalColumn New DataColumn Total Type GetType system Decimal Certkiller Columns Add totalColumn totalColumn Equals Quantity UnitPrice CertkillerDetails DisplayExpression Quantity UnitPrice Certkiller Details DisplayExpression quantityColumn unitpriceColum Answer A Explanation We use the Expression property of the DataColumn object calculate the values in the column Reference NET Framework Developer's Guide Creating Expression Columns C NET Framework Class Library DataColumn Class C NET Framework Class Library Object Equals Method Object C NET Framework Class Library DataTable DisplayExpression Property C Incorrect Answers B The Equals method cannot be used in this way The equals method is used to test if different objects are equal C D The DisplayedExpression would be set to a string value not a calculated value QUESTION As a software developer at Certkiller you create a user control named ScrollControl which you plan to sell to developers You want to ensure that ScrollControl can be used only by developers who purchase a license to use it You decide to use a license provider implemented by the LicFileLicenseProvider class Now you need to add code to ScrollControl to test for a valid control license Which two code segments should you add Each correct answer presents part of the solution Choose two LicenseProvider typeof LicFileLicenseProvider LicenseProvider typeof ScrollControl In the Load event handler for ScrollControl place the following code segment License controlLicense try controlLicense LicenseManager Validate typeof ScrollControl catch Exception exp Insert code to disallow use In the Load event handler for ScrollControl place the following code segment License controlLicense try controlLicense LicenseManager Validate typeof ScrollControl this catch Exception exp Insert code to disallow use In the Load event handler for ScrollControl place the following code segment Bool blicensed try blicensed LicenseManager IsValid Typeof scrollControl catch Exception exp Insert code to disallow use F In the Load event handler for ScrollControl place the following code segment LicenseManager IsValid typeof ScrollControl this to disallow use Answer A D QUESTION You develop a Windows-based application Certkiller App that includes several menus Every top-level menu contains several menu items and certain menus contain items that are mutually exclusive You decide to distinguish the single most important item in each menu by changing its caption text to bold type What should you do Set the DefaultItem property to True Set the Text property to b True b Set the Checked property to True Set the OwnerDraw property to True Answer A Explanation Gets or sets a value indicating whether the menu item is the default menu item The default menu item for a menu is boldfaced Reference NET Framework Class Library MenuItem DefaultItem Property C Incorrect Answers The Text property contains the text that is associated with the control We cannot format this text by HTML-like tags in the text We don't want the menu-item to be selected just bold When the OwnerDraw property is set to true you need to handle all drawing of the menu item You can use this capability to create your own special menu displays QUESTION You use Visual Studio NET to create a Windows-based application for online gaming Each user will run the client version of the application on his or her local computer In the game each user controls two groups of soldiers Group and Group You create a top-level menu item whose caption is Groups Under this menu you create two submenus One is named group Submenu and its caption is Group The other is named group Submenu and its caption is Group When the user select the Groups menu the two submenus will be displayed The user can select only one group of soldiers at a time You must ensure that a group can be selected either by clicking the appropriate submenu item or by holding down the ALT key and pressing or You must also ensure that the group currently select will be indicated by a dot next to the corresponding submenu item You do not want to change the caption text of any of your menu items Which four actions should you take Each correct answer presents part of the solution Choose four A Set group Submenu Text to Group Set group Submenu Text to Group Set Group ShortCut to ALT Set Group ShortCut to ALT In the group Submenu Click event place the following code segment group submenu Defaultitem true In the group Submenu Click event place the following code segment group submenu Defaultitem true In the group Submenu Click event place the following code segment grouplsubmenu Defaultitem false In the group Submenu Click event place the following code segment grouplsubmenu Defaultitem false In the group Submenu Click event place the following code segment grouplsubmenu Checked true In the group Submenu Click event place the following code segment group submenu Checked true In the group Submenu Click event place the following code segment group subemnu Checked false In the group Submenu Click event place the following code segment group subemnu Checked false Set group Submenu RadioCheck to True Set group Submenu RadioCheck to True H Set group Submenu RadioCheck to False Set group Submenu RadioCheck to False Answer B E F G Explanation B Simply set the Group Shortcut to appropriate value E F The menu item's Checked property is either true or false and indicates whether the menu item is selected We should set the clicked Submenu Checked property to True and the other Submenu Checked property to False The menu item's RadioCheck property customizes the appearance of the selected Reference Visual Basic and Visual C Concepts Adding Menu Enhancements to Windows Forms Visual Basic and Visual C Concepts Introduction to the Windows Forms MainMenu Component Incorrect Answers You do not want to change the caption text of any of your menu items C D We are not interested in defining default items We want to mark items as checked The RadioCheck property must be set to True for both menu items QUESTION You work as a software developer at Certkiller com You application uses a DataSet object to maintain a working set of data for your users Users frequently change information in the DataSet object Before you update your database you must run data validation code on all user changes You need to identify the data rows that contain changes First you create a DataView object What should you do next Set the RowStateFilte CompareTo method Set the RowStateFilter Equals method Set the RowStateFilter property to CurrentRows Set the RowStateFilter property to ModifiedCurrent Answer D Correct answer is Set the RowStateFilter property to ModifiedCurrent this will shows changed rows and the current values QUESTION You develop a Windows-based orderentry application Certkiller App The application uses a DataSet object named customerDataSet to manage client data while users edit and update customer records The DataSet object contains a DataTable object named creditAuthorizationDataTable This object contains a field named MaxCredit which specifies the credit limit for each customer Customer credit limits cannot exceed Therefore Certkiller App must verify that users do not enter a larger amount in MaxCredit If a user does so the user must be notified and the error must be corrected before any changes are stored permanently in the database You create a procedure named OnRowChanged This procedure sets the DataTable Row RowError property for each row that includes an incorrect credit limit You also enable the appropriate event handling so OnRowChanged is called in reaction to the RowChanged event of the DataTable object OnRowChanged will run each time a user changes data in a row OnRowChanged contains the following code segment private sender DataRowChanged Object sender DataRowChangeEventArgs e if double e Row MaxCKCredit e Row RowError Over credit limit Before updating the database your application must identify and correct all rows that are marked as having an error Which code segment should you use foreach DataRow myRow in creditAuthorizationDataTable GetErrors MessageBox Show String Format CustID Error MyRow CustID myRow RowError foreach DataRow myRow in creditAuthorizationDataTable HasErrors MessageBox Show String Format CustID Error MyRow CustID myRow RowError DataView vw new DataView customerDataSet Tables creditAuthorizationDataTable DataViewRowstate ModifiedCurrent MessageBox Show DataView vw new DataView customerDataSet Tables creditAuthorizationDataTable MessageBox Show Answer A Explanation GetErrors method gets an array of DataRow objects that contain errors We use the GetErrors method to get retrieve all rows that contain errors Reference NET Framework Class Library DataRow RowError Property C Incorrect Answers The HasErrors property is used to determine if a DataRow contains errors It returns a Boolean value not an array of DataRow objects We don't want to access the current version the rows just the rows that contain errors We don't want to access the original version the rows just the rows that contain errors QUESTION You use Visual Studio NET to create a data entry form The form enables users to edit personal information such as address and telephone number The form contains a text box named textPhoneNumber If a user enters an invalid telephone number the form must notify the user of the error You create a function named IsValidPhone that validates the telephone number entered You include an ErrorProvider control named ErrorProvider in your form Which additional code segment should you use A private void textPhone Validating object sender System ComponentModel CancelEventArgs e if IsValidPhone errorProviderl SetError TextPhone Invalid Phone private void textPhone Validated object sender System EventArgs e if IsValidPhone errorProviderl SetError TextPhone Invalid Phone private void textPhone Validating object sender System ComponentModel CancelEventArgs e if IsValidPhone errorProviderl GetError textPhone Phone private void textPhone Validated object sender System EventArgs e if IsValidPhone errorProviderl GetError textPhone Phone private void textPhone Validating object sender System ComponentModel CancelEventArgs e if IsValidPhone errorProviderl UpdateBinding F private void textPhone Validated object sender System EventArgs e if IsValidPhone errorProviderl UpdateBinding Answer A Explanation The Validating event allows you to perform sophisticated validation on controls It is possible to use an event handler that doesn't allow the focus to leave the control until a value has been entered The ErrorProvider component provides an easy way to communicate validation errors to users The SetError method of the ErrorProvider class sets the error description string for the specified control Note Focus events occur in the following order Enter GotFocus Leave Validating Validated LostFocus Reference - - Training kit To create a validation handler that uses the ErrorProvider component Pages - NET Framework Class Library ErrorProvider SetError Method C Incorrect Answers C The GetError method returns the current error description string for the specified control E The updateBinding method provides a method to update the bindings of the DataSource DataMember and the error text However we just want to set the error description B D F The validated event occurs when the control is finished validating It can used to perform any actions based upon the validated input QUESTION You work as a software developer at Certkiller com You develop a Windows-based application that includes two objects named Certkiller Contact and Certkiller Employee Certkiller Employee inherits from Certkiller Contact and Certkiller Contact exposes an event named DataSaved You want to raise the DataSaved event from Certkiller Employee What should you do Call the RaiseEvent method from Certkiller Employee and pass DataSaved as the event name Add the Public keyword to the DataSaved declaration in Certkiller Contact Call the RaiseEvent method from Certkiller Employee In Certkiller Contact create a protected method named RaiseDataSaved that explicitly raises the DataSaved event Call RaiseDataSaved from Certkiller Employee In Certkiller Employee create a protected method named RaiseDataSaved that explicitly raises the DataSaved event in Certkiller Contact Call RaiseDataSaved to fire the event Answer A QUESTION You use Visual Studio NET to create a form that includes a submenu item named helpCKOption In the Click event handler for helpOption you write code to open a Web browser loaded with a context-sensitive Help file You add a ContextMenu item named ContextMenu to the form ContextMenu will be used for all controls on the form Now you need to add code to the Popup event handler for ContextMenu Your code will create a popup menu that offers the same functionality as helpCKOption You want to use the minimum amount of code to accomplish this goal Which two code segments should you use Each correct answer presents part of the solution Choose two ContextMenu MenuItems Clear ContextMenu MenuItems Add Display Help ContextMenu MenuItems Add helpCKOption CloneMenu ContextMenu MenuItems Click new System EventHandler helpCKOption Click ContextMenu Popup new System EventHandler helpCKOption Click Answer A C QUESTION You use Visual Studio NET to develop a Windows-based application The application includes several menu controls that provide access to most of the application's functionality One menu option is named calculateOption When a user chooses this option the application will perform a series of calculations based on information previously entered by the user To provide user assistance you create a TextBox control named Certkiller Help The corresponding text box must display help information when the user pauses on the menu option with a mouse or navigates to the option by using the arrow keys You need to add the following code segment Certkiller Help Text This menu option calculates the In which event should you add this code segment calculateOption Click calculateOption Popup calculateOption Select calculateOption DrawItem calculateOption MeasureItem Answer C Explanation The Select event is raised when a menu item is highlighted We should use the Select event to set the helper text Reference - - Training kit Using Menu Item Events Page Incorrect Answers The Click event occurs when a menu item is selected The Popup event is raised just before a menu item's list of menu items is displayed It can be used to enable and disable menu items at run time before the menu is displayed The DrawItem event handler provides a Graphics object that enables you to perform drawing and other graphical operations on the surface of the menu item E The MeasureItem event occurs when the menu needs to know the size of a menu item before drawing it QUESTION You use Visual Studio NET to create a Windows- based application On the main application form Certkiller FormMain you create a TextBox control named textConnectionString Users can enter a database connection string in this box to access customized data from any database in your company You also create a Help file to assist users in creating connection strings The Help file will reside on your company intranet Your application must load the Help file in a new browser window when the user presses F key but only of textConnectionString has focus You must create this functionality by using the minimum amount of code In which event should you write the code to display the Help file textConnectionString KeyPress textConnectionString KeyDown textConnectionString KeyUp textConnectionString GiveFeedback textConnectionString HelpRequested Answer E Explanation The Control HelpRequested Event occurs when the user requests help for a control The HelpRequested event is commonly raised when the user presses the F key or an associated context-sensitive help button is clicked This would be the most straightforward solution and would require minimal code Note Key events occur in the following order KeyDown KeyPress KeyUp Reference NET Framework Class Library Control HelpRequested Event C NET Framework Class Library Control KeyDown Event C Incorrect Answers A The KeyPress event occurs when a key is pressed while the control has focus The KeyPress event could be used to provide a solution but it would require more code B The KeyDown event occurs when a key is pressed while the control has focus C The KeyUp occurs when a key is released while the control has focus D The Control GiveFeedback does not apply here It occurs during a drag operation QUESTION You work as software developer at Certkiller inc You need to develop a Windows form that provides online help for users You want the help functionality to be available when users press the F key Help text will be displayed in a pop-up window for the text box that has focus To implement this functionality you need to call a method of the HelpProvider control and pass the text box and the help text What should you do SetShowHelp SetHelpString SetHelpKeyword ToString Answer B Explanation To associate a specific Help string with another control use the SetHelpString method The string that you associate with a control using this method is displayed in a pop-up window when the user presses the F key while the control has focus Reference Visual Basic and Visual C Concepts Introduction to the Windows Forms HelpProvider Component QUESTION You develop a Windows-based application Its users will view and edit employee attendance data The application uses a DataSet object named customerDataSet to maintain the data while users are working with it After a user edits data business rule validation must be performed by a middle-tier component named CertK Component You must ensure that your application sends only edited data rows from customDataSet to CertK Component Which code segment should you use DataSet changeDataSet new DataSet if customDataSet HasChanges CertK Component Validate changeDataSet DataSet changeDataSet new DataSet if customDataSet HasChanges CertK Component Validate customDataSet DataSet changeDataSet customDataSet GetChanges CertK Component Validate changeDataSet DataSet changeDataSet customDataSet GetChanges CertK Component Validate customDataSet Answer C QUESTION You develop a Windows- based application that will retrieve Certkiller employee vacation data and display it in a DataGrid control The data is managed locally in a DataSet object named employeeDataSet You need to write code that will enable users to sort the data by department Which code segment should you use DataView dvDept new DataView dvDept Table employeeDataSet Tables dvDept Sort ASC DataGrid DataSource dvDept DataView dvDept new DataView dvDept Table employeeDataSet Tables dvDept Sort Department DataGrid DataSource dvDept DataView dvDept new DataView dvDept Table employeeDataSet Tables dvDept ApplyDefaultSort true DataGrid DataSource dvDept DataView dvDept new DataView dvDept Table employeeDataSet Tables dvDept ApplyDefaultSort false DataGrid DataSource dvDept Answer B QUESTION You develop a Windows-based application to manage business contacts The application retrieves a list of contacts from a central database The list is managed locally in a DataSet object named listDataSet and it is displayed in a DataGrid control You create a procedure that will conduct a search after you enter a combination of personal name and family name You application currently includes the following code segment DataView dv new DataView int i dv Table listDataSet Tables dv Sort FamilyName PersonalName DataGrid DataSource dv You need to search for a conduct whose personal name is Jack and whose family name is Bill Which code segment should you use object values Bill Jack i dv Find values DataGrid CurrentRowIndex i object values Bill Jack i dv Find values DataGrid CurrentRowIndex i C object values Jack Bill i dv Find values DataGrid CurrentRowIndex i D object values Jack Bill i dv Find values DataGrid CurrentRowIndex i Answer A Explanation We load the search parameters into an array We use two separate values The first value is the FamilyName and the second is PersonalName as it is used in the sort command dv Sort FamilyName PersonalName The family name is Bill The personal name is Jack Reference - - Training kit Filtering and Sorting in a DataSet Page Incorrect Answers B D There are two columns We must separate the Family name and the Personal into two separate strings C Wrong order of the search parameters The family name Bill must be the first search parameter QUESTION You use Visual Studio NET to develop a Windows -based application Your application will display customer order information from a Microsoft SQL Server database The orders will be displayed on a Windows Form that includes a DataGrid control named Certkiller Grid Certkiller Grid is bound to a DataView object Users will be able to edit order information directly in Certkiller Grid You must give users the option of displaying only edited customer orders and updated values in Certkiller Grid What should you do Set the RowStateFilter property of the DataView object to DataViewRowState ModifiedOriginal Set the RowStateFilter property of the DataView object to DataViewRowState ModifiedCurrent Set the RowFilter property of the DataView object to DataViewRowState ModifiedOriginal Set the RowFilter property of the DataView object to DataViewRowState ModifiedCurrent Answer B Explanation We must set the RowStateFilter property of the DataView to specify which version or versions of data we want to view We should use the ModifiedCurrent DataViewRowState which provides the modified version of original data Reference NET Framework Class Library DataViewRowState Enumeration C Incorrect Answers A C The ModifiedOriginal DataViewRowState is used to get the original version of the rows in the view We are interested in the modified rows however D We are not applying an usual filter with the RowFilter property We must use a RowStateFilter QUESTION As a developer at Certkiller you develop a new salesanalysis application that reuses existing data access components One of these components returns a DataSet object that contains the data for all customer orders for the previous year You want your application to display orders for individual product numbers Users will specify the appropriate product numbers at run time What should you do Use the DataSet Reset method Set the RowFilter property of the DataSet object by using a filter expression Create a DataView object and set the RowFilter property by using a filter expression Create a DataView object and set the RowStateFilter property by using a filter expression Answer C Explanation You filter data by setting the RowFilter property The RowFilter property takes a String that can evaluate to an expression to be used for selecting records RowFilter is a property of the DataView object Reference Visual Basic and Visual C Concepts Filtering and Sorting Data Using Data Views Incorrect Answers The DataSet-Reset method resets the DataSet to its original state RowFilter is not a property of the DataSet object D The RowStateFilter property is used to filter based on a version or state of a record Filter expressions cannot be used on RowStateFilters The RowStates are Added CurrentRows Deleted ModifiedCurrent ModifiedOriginal None OriginalRows and Unchanged QUESTION You use Visual Studio NET to develop a Windows-based application called Certkiller App Your application will display customer orderinformation from a Microsoft SQL Server database The orders will be displayed on a Windows Form in a data grid named DataGrid DataGrid is bound to a DataView object The Windows Form includes a button control named displayBackOrder When users click this button DataGrid must display only customer orders whose BackOrder value is set to True How should you implement this functionality Set the RowFilter property of the DataView object to BackOrder True Set the RowStateFilter property of the DataView object to BackOrder True Set the Sort property of the DataView object to BackOrder True Set the ApplyDefaultSort property of the DataView object to True Answer A Explanation Using the RowFilter property of a data view you can filter records in a data table to make available only records you want to work with Reference Visual Basic and Visual C Concepts Introduction to Filtering and Sorting in Datasets Visual Basic and Visual C Concepts Filtering and Sorting Data Using Data Views Incorrect Answers B To filter based on a version or state of a record set the RowStateFilter property It does not apply here C D We want to filter not sort the data view QUESTION You use Visual Studio NET to develop a Windows-based application that interacts with a Microsoft SQL Server database Your application contains a form named CustomerForm which includes the following design-time components SqlConnection object named Certkiller Connection SqlDataAdapter object named Certkiller DataAdapter DataSet object named Certkiller DataSet based on a database table named Customers At run time you add a TextBox control named textCompanyName to CustomerForm You execute the Fill method of Certkiller DataAdapter to populate Customers Now you want to use data binding to display the CompanyName field exposed by Certkiller DataSet in textCompanyName Which code segment should you use textCompanyName DataBindings Add Text Certkiller DataSet CompanyName textCompanyName DataBindings Add Text Certkiller DataSet Customers CompanyName textCompanyName DataBindings Add Text Certkiller DataAdapter CompanyName textCompanyName DataBindings Add Text Certkiller DataAdapter Customers CompanyName Answer B QUESTION You use Visual Studio NET to create a Windows Form named Certkiller Form You add a custom control named BarGraph which displays numerical data You create a second custom control named DataBar Each instance of DataBar represents one data value in BarGraph BarGraph retrieves its data from a Microsoft SQL Server database For each data value that it retrieves a new instance of DataBar is added to BarGraph BarGraph also includes a Label control named DataBarCount which displays the number of DataBar controls currently contained by BarGraph You must add code to one of your custom controls to ensure that DataBarCount is always updated with the correct value What are two possible ways to achieve this goal Each correct answer presents a complete solution Choose two Add the following code segment to the ControlAdded event handler for DataBar this DataBarCount Text this Controls Count Add the following code segment to the ControlAdded event handler for DataBar this DataBarCount Text Parent Controls Count Add the following code segment to the ControlAdded event handler for BarGraph DataBarCount Text this Controls Count Add the following code segment to the constructor for BarGraph this Parent DataBarCount Text this Controls Count Add the following code segment to the constructor for DataBar this Parent DataBarCount Text this Controls Count Add the following code segment to the AddDataPoint method of BarGraph DataBarCount Text this Parent Controls Count Answer C E Explanation We could either catch the ControlAdded event or add code the constructor The Control ControlAdded Event occurs when a new control is added to the Control ControlCollection When a control is added to BarGraph we could set the count of controls to the number of current controls in BarGraph Every time a new DataBar is constructed we could set the counter Reference NET Framework Class Library Control ControlAdded Event C Incorrect Answers A B Controls are added to BarGraph not to the DataBar DataBars not BarGraphs are constructed F The AddDataPoint method does not apply QUESTION You use Visual Studio NET to develop a Microsoft Windows-based application Your application contains a form named CustomerForm which includes the following design-time controls SQLConnection object named Certkiller Connection SQLDataAdapter object named Certkiller DataAdapter DataSet object named CustomerDataSet Five TextBox controls to hold the values exposed by CustomerDataSet Button control named saveButton At design time you set the DataBindings properties of each TextBox control to the appropriate column in the DataTable object of CustomerDataSet When the application runs users must be able to edit the information displayed in the text boxes All user changes must be saved to the appropriate database when saveButton is executed The event handler for saveButton includes the following code segment Certkiller DataAdapter Update CustomerDataSet You test the application However saveButton fails to save any values edited in the text boxes You need to correct this problem What should your application do Call the InsertCommand method of Certkiller DataAdapter CALL THE Update method of Certkiller DataAdapter and pass in Certkiller Connection Before calling the Update method ensure that a row position change occurs in CustomerDataSet Reestablish the database connection by calling the Open method of Certkiller Connection Answer C Explanation Not B There is no connection parameter in the Update method of the DataAdapter class Reference Visual Basic and Visual C Concepts Dataset Updates in Visual Studio NET NET Framework Class Library SqlDataAdapter Constructor String SqlConnection C QUESTION You develop a Windows-based application CertK CertK uses a DataSet object that contains two DataTable objects CertK will display data from two data tables One table contains customer information which must be displayed in a data-bound ListBox control The other table contains orderinformation which must be displayed in a DataGrid control You need to modify CertK to enable the list box functionality What should you do Use the DataSet Merge method Define primary keys for the Data Table objects Create a foreign key constraint on the DataSet object Add a DataRelation object to the Relations collection of the DataSet object Answer D Explanation You can use a DataRelation to retrieve parent and child rows Related rows are retrieved by calling the GetChildRows or GetParentRow methods of a DataRow Note A DataRelation object represents a relationship between two columns of data in different tables The DataRelation objects of a particular DataSet are contained in the Relations property of the DataSet A DataRelation is created by specifying the name of the DataRelation the parent column and the child column Reference - - Training kit Retrieving Related Records Page Incorrect Answers The Merge method is used to merge two DataSet objects that have largely similar schemas A merge does not meet the requirements of the scenario however Primary keys would not help relating the DateTable objects C Foreign key constraints put restrictions on the data in two different tables However it would not help in retrieving related records QUESTION You develop a Windows-based application to manage business contacts The application retrieves a list of contacts from a central database called Certkiller DB The list of contacts is managed locally in a DataSet object named contactDataSet To set the criteria for retrieval your user interface must enable users to type a city name into a TextBox control The list of contacts that match this name must then be displayed in a DataGrid control Which code segment should you use DataView contactDataSet new DataView dv Table contactDataSet Tables dv RowFilter TextBox Text DataGrid DataSource dv DataView dv new DataView dv Table contactDataSet Tables dv RowFilter String Format City ' ' TextBox Text DataGrid DataSource dv DataView contactDataSet new DataView dv Table contactDataSet Tables dv Sort TextBox Text DataGrid DataSource dv DataView dv new DataView dv Table contactDataSet Tables dv Sort String Format City ' ' TextBox Text Answer B Explanation To form a RowFilter value specify the name of a column followed by an operator and a value to filter on The value must be in quotes Here we use construct the rowfilter with the operator string concatenation and the TextBox Text property Reference NET Framework Class Library DataView RowFilter Property C Incorrect Answers A We must use the operator and construct an expression We cannot just use a value C D We want to filter the Dataset not to sort it QUESTION You use Visual Studio NET to develop a Windows-based application that interacts with a Microsoft SQL Server database Your application contains a form named CustomerForm You add the following design-time components to the form SqlConnection object named Certkiller Connection SqlDataAdapter object named Certkiller DataAdapter DataSet object named Certkiller DataSet Five TextBox controls to hold the values exposed by Certkiller DataSet At design time you set the DataBindings properties of each TextBox control to the appropriate column in the DataTable object of Certkiller DataSet When you test the application you can successfully connect to the database However no data is displayed in any text boxes You need to modify your application code to ensure that data is displayed appropriately Which behavior should occur while the CustomerForm Load event handler is running Execute the Add method of the TextBoxes DataBindings collection and pass in Certkiller DataSet Execute the BeginInit method of Certkiller DataSet Execute the Open method of Certkiller Connection Execute the FillSchema method of Certkiller DataAdapter and pass in Certkiller DataSet Execute the Fill method of Certkiller DataAdapter and pass in Certkiller DataSet Answer E Explanation Dataset is a container therefore you need to fill it with data You can populate a dataset by calling the Fill method of a data adapter Reference Visual Basic and Visual C Concepts Introduction to Datasets QUESTION You development team at Certkiller com is using Visual Studio NET to create an accounting application which contains a substantial amount of code Sometimes a developer cannot complete a portion of code until dependencies are completed by another developer In these cases the developer adds a comment in the application code about the work left incomplete Such comments always begin with the UNDONE You open the application code on your computer As quickly as possible you need to view each comment that indicates incomplete work What should you do Configure the Task List window to show all tasks Use the Build Comment Web Pages dialog box to build Comment Web Pages for the entire solution Open a code window and use the Find in Files dialog box to search the application code for UNDONE Open a code window and use the Find dialog box to search all open documents for UNDONE Answer A Explanation A is a much easier solution B provides no more information but takes longer to use QUESTION You develop a Windows-based application named Certkiller by using Visual Studio NET Certkiller consumes an XML Web service named MortgageRate and exposes a method named GetCurrentRate Certkiller uses GetCurrentRate to obtain the current mortgage interest rate Six months after you deploy Certkiller users begin reporting errors You discover that MortgageRate has been modified GetCurrentRate now requires you to pass a postal code before returning the current mortgage interest rate You must ensure that Certkiller consumes the most recent version of MortgageRate You must achieve this goal in the most direct way possible What should you do Use Disco exe to generate a new proxy class for MortgageRate Modify the Certkiller code to pass the postal code to GetCurrentRate Use the Update Web Reference menu item to update the reference to MortgageRate in Certkiller Use the Add Reference dialog box to recreate the reference to MortgageRate in Certkiller Remove the reference to MortgageRate in Certkiller Use the Add Web Reference dialog box to create the reference Answer C Explanation If your application contains a Web reference to an XML Web service that has been recently modified on the server you may need to update the reference in your project To update a project Web reference In Solution Explorer access your project's Web References folder and select the node for the Web reference you want to update Right-click the reference and click Update Web Reference Reference Visual Basic and Visual C Concepts Managing Project Web References QUESTION Your development team is creating a new Windows-based application for the Certkiller company The application consists of a user interface and several XML Web services You develop all XML Web services and perform unit testing Now you are ready to write the user interface code Because some of your servers are being upgraded the XML Web service that provides mortgage rates is currently offline However you have access to its description file You must begin writing code against this XML Web service immediately What should you do Generate the proxy class for the XML Web service by using Disco exe Generate the proxy class for XML Web service by using Wsdl exe Obtain a copy of the XML Web service assembly and register it on your local development computer Add the description file for the XML Web service to your Visual Studio NET project Answer B Explanation Ordinarily to access an XML Web service from a client application you first add a Web reference which is a reference to an XML Web service When you create a Web reference Visual Studio creates an XML Web service proxy class automatically and adds it to your project However you can manually generate a proxy class using the XML Web services Description Language Tool Wsdl exe used by Visual Studio to create a proxy class when adding a Web reference This is necessary when you are unable to access the XML Web service from the machine on which Visual Studio is installed such as when the XML Web service is located on a network that will not be accessible to the client until run time You then manually add the file that the tool generated to your application project Reference Visual Basic and Visual C Concepts Locating XML Web Services Visual Basic and Visual C Concepts Generating an XML Web Service Proxy QUESTION You use Visual Studio NET to create an assembly called Certkiller Assembly that will be used by other applications including a standard COM client application You must deploy your assembly on the COM application to a client computer You must ensure that the COM application can instantiate components within the assembly as COM components What should you do Create a strong name of the assembly by using the Strong Name tool Sn exe Generate a registry file for the assembly by using the Assembly Registration tool Regasm exe Register the file on the client computer Generate a type library for the assembly by using the Type Library Importer Tlbimp exe Register the file on the client computer Deploy the assembly to the global assembly cache on the client computer Add a reference to the assembly in the COM client application Answer B Explanation 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 Once a class is registered any COM client can use it as though the class were a COM class Reference NET Framework Tools Assembly Registration Tool Regasm exe NET Framework Tools Strong Name Tool Sn exe NET Framework Tools Type Library Importer Tlbimp exe Incorrect Answers A The Strong Name tool helps sign assemblies with strong names The Type Library Importer tlbimp exe converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly It would not be useful in this scenario however This would not allow the COM application to use the class QUESTION You development team used Visual Studio NET to create an accounting application which contains a class named Certkiller Accounts This class instantiates several classes from a COM component that was created by using Visual Basic Each COM component class includes a custom method named ShutDownObject that must be called before terminating references to the class Software testers report that the COM component appears to remain in memory after the application terminates You must ensure that the ShutDownObject method of each COM component class is called before Certkiller Accounts is terminated What should you do Add code to the Terminate event of Certkiller Accounts to call the ShutDownObject method of each COM component class Find each location in your code where a reference to Certkiller Accounts is set to null or goes out of scope Add code after each instance to manually invoke the Visual Studio NET garbage collector Add a destructor to Certkiller Accounts Add code to the destructor to call the ShutDownObject method of each COM component class D Add the procedure private void Finally to Certkiller Accounts Add code to the procedure to call the ShutDownObject method of each COM component class Answer C Explanation Be creating a destructor for Certkiller Accounts class we can ensure that appropriate actions are performed before Certkiller Accounts is terminated Reference C Language Specification Destructors QUESTION You use Visual Studio NET to create an application Your application contains two classes Region and City which are defined in the following code segment Line numbers are included for reference only public class Region public virtual void Calculate CertK Tax Code to calculate tax goes here public class City Region public override void Calculate CertK Tax Insert new code You need to add code to the Calculate CertK Tax method of the City class to call the Calculate CertK Tax method of the Region class Which code segment should you add on line Calculate CertK Tax this Calculate CertK Tax base Calculate CertK Tax D Region r new Region r Calculate CertK Tax Answer C QUESTION You use Visual Studio NET to develop applications for your human resources department at Certkiller You create the following interfaces Certkiller You create the following interfaces public interface IEmployee double Salary public interface IExecutive IEmployee double AnnualBonus The IEmployee interface represents a generic Employee concept All actual employees in your company should be represented by interfaces that are derived from IEmployee Now you need to create a class named Manager to represent executives in your company You want to create this class by using the minimum amount of code Which code segment or segments should you include in Manager Choose all that apply public class Manager IExecutive public class Manager IEmployee IExecutive public class Manager IEmployee public class Manager IExecutive IEmployee public double Salary public double AnnualBonus Answer A E F A class can implement an Interface The Manager class should implement the IExecutive interface E F The properties that are defined in the Interface must be implemented in a Class Incorrect Answers The class should not implement both Interfaces just the IExecutive interface C D A class cannot inherit from an Interface QUESTION You use Visual Studio NET to develop a component named Certkiller Component You plan to develop several client applications that use Certkiller Component You need to deploy Certkiller Component with each of these applications You will create a distribution package to be included with each application Which type of project should you create CAB project merge module project setup project Web setup project Answer B Explanation Merge Module projects allow you to create reusable setup components They create a merge module msm file that includes all files resources registry entries and setup logic for your component The resulting msm file can then be merged into other deployment projects insuring consistent installation of your component across multiple applications Reference Visual Studio Merge Module Projects Visual Studio Creating or Adding a Merge Module Project QUESTION You develop a Windows-based application that contains a form named Contact Certkiller You need to write code to initialize all class-level variables in Contact Certkiller as soon as Contact Certkiller is instantiated You will place your code in a public procedure in the Contact Certkiller class Which public procedure should you use Create Initialize Load New Answer C Explanation The Form Load Event occurs before a form is displayed for the first time You can use this event to perform tasks such as allocating resources used by the form Reference NET Framework Class Library Form Load Event C Incorrect Answers Create does not apply here In Visual Basic the Initialize event was used to execute code before a form was loaded There is not such event in C NET New is not a public procedure It is a class constructor QUESTION You plan to use Visual Studio NET to create a class named CertK BusinessRules which will be used by all applications in your company CertK BusinessRules defines business rules and performs calculations based on those rules Other developers in your company must not be able to override the functions and subroutines defined in CertK BusinessRules with their own definitions Which two actions should you take to create BusinessRules Each correct answer presents part of the solution Choose two Create a Windows control library project Create a class library project Create a Windows Service project Use the following code segment to define BusinessRules protected class CertK BusinessRules Use the following code segment to define BusinessRules public new class CertK BusinessRules Use the following code segment to define BusinessRules public sealed class CertK BusinessRules Use the following code segment to define BusinessRules public abstract class CertK BusinessRules Answer B F Explanation You can use the Class Library template to quickly create reusable classes and components that can be shared with other projects A sealed class cannot be inherited It is an error to use a sealed class as a base class Use the sealed modifier in a class declaration to prevent accidental inheritance of the class Reference Visual Basic and Visual C Concepts Class Library Template C Programmer's Reference sealed - - Training kit Creating Classes That Cannot Be Inherited Page Incorrect Answers The Windows Control Library project template is used to create custom controls to use on Windows Forms When you create a service you can use a Visual Studio NET project template called Windows Service However we want to implement Business rules not network services A protected class will hide properties from external classes and thus keep this functionality encapsulated within the class However the class could still be overridden Incorrect use of keyword new Option E produces compile time error so you can't even create class with that syntax so it surely dont let the developers to inherit from nor to override it's members The abstract modifier is used to indicate that a class is incomplete and that it is intended to be used only as a base class QUESTION You use Visual Studio NET to create an application named Certkiller Client Another developer in your company creates a component named Certkiller Component Your application uses namespaces exposed by Certkiller Component You must deploy both Certkiller Client and Certkiller Component to several computers in your company's accounting department You must also ensure that Certkiller Component can be used by future client applications What are three possible ways to achieve your goal Each correct answer presents a complete solution Choose three Deploy Certkiller Client and Certkiller Component to a single folder on each client computer Each time a new client application is developed place the new application in its own folder and copy Certkiller Component to the new folder Deploy Certkiller Client and Certkiller Component to a single folder on each client computer Each time a new client application is developed place the new application in its own folder Edit Certkiller Client exe config and add a privatePath tag that points to the folder where Certkiller Component is located Deploy Certkiller Client and Certkiller Component to separate folders on each client computer In each client application that will use Certkiller Component add the following code segment using Certkiller Component Deploy Certkiller Client and Certkiller Component to separate folders on each client computer Each time a new client application is developed select Add Reference from the Tools menu and add a reference to Certkiller Component Deploy Certkiller Client and Jack CBill Component to separate folders on each client computer Register Certkiller Component on each client computer by using the RegSvr utility Deploy Certkiller Client and Certkiller Component to separate folders on each client computer Add Certkiller Component to the global assembly cache Answer A B F Explanation XCOPY deployment of the Certkiller Component we simply copy the component to the deployment folder of every application that requires the use of the components enables the deployed application to use the component This would give the future client applications access to Certkiller Component F If you intend to share an assembly among several applications you can install it into the global assembly cache Reference - - Training kit Accessing NET and COM Type Libraries Pages - NET Framework Developer's Guide Working with Assemblies and the Global Assembly Cache C Programmer's Reference using Directive Incorrect Answers The using keyword has two major uses using Directive Creates an alias for a namespace using Statement Defines a scope at the end of which an object will be disposed However this would not make the component accessible Adding references does not provide access to library in runtime FileNotFound exception RegSrv was used in before the introduction of Visual Studio NET to register dll file It is no longer required QUESTION You use Visual Studio NET to create a Windows-based application that will track Certkiller sales The application's main object is named Certkiller The Certkiller class is created by the following definition public class Certkiller You write code that sets properties for the Certkiller class This code must be executed as soon as an instance of the Certkiller class is created Now you need to create a procedure in which you can place your code Which code segment should you use public Certkiller public void Certkiller public bool Certkiller public New public Certkiller New public Certkiller Certkiller Answer A Explanation We must create a constructor for the class We wrote a method whose name is the same as the name of the class and we specify not return type not even void Reference Visual C Step by step page Incorrect Answers B C We cannot specify any return type not even void when we define a constructor for a class D The constructor must have the name of the class Incorrect syntax This is not the way to create a constructor QUESTION Another developer creates data files by using a computer that runs a version of Microsoft Windows XP Professional distributed in France These files contain financial transaction information including dates times and monetary values The data is stored in a culture-specific format You develop an application Certkiller Interactive which uses these data files You must ensure that Certkiller Interactive correctly interprets all the data regardless of the Culture setting of the client operating system Which code segment should you add to your application using System Threading using System Data Thread CurrentThread CurrentCulture new CultureInfo fr-FR using System Threading using System Data Thread CurrentThread CurrentCulture new TextInfo fr-FR using System Threading using System Globalization Thread CurrentThread CurrentCulture new CultureInfo fr-FR using System Threading using System Globalization Thread CurrentThread CurrentCulture new TextInfo fr-FR Answer C Explanation The CultureInfo represents information about a specific culture including the names of the culture the writing system and the calendar used as well as access to culture-specific objects that provide methods for common operations such as formatting dates and sorting strings Reference - - Training kit Getting and Setting the Current Culture Pages - NET Framework Class Library CultureInfo Class C Incorrect Answers A We must use the System Globalization namespace not the System Data namespace B D The TextInfo property provides culture-specific casing information for strings QUESTION You are preparing a localized version of a Windows Form named Certkiller Local Users of Certkiller Local speak a language that prints text from right to left User interface elements on the form need to conform to this alignment You must ensure that all user interface elements are properly formatted when the localized Windows Form runs You must also ensure that Certkiller Local is easy to update and maintain What should you do Set the RightToLeft property of each control on the form to Yes Set the RightToLeft property of the form to Yes Set the Language property of the form to the appropriate language Set the Localizable property of the form to True Answer B Explanation The RightToLeft property is used for international applications where the language is written from right to left Reference Visual Basic and Visual C Concepts Displaying Right-to-Left Text in Windows Forms for Globalization Incorrect Answers A The RightToLeft property can be set either to controls or to the form The best solution is to set the property only for the form The Language property is not used to format text The Localizable property is not used to format text QUESTION You work as a software developer at Certkiller com You create a form in your Windows-based application The form contains a command button named check Certkiller Button When check Certkiller Button is clicked the application must call a procedure named Get Certkiller Which two actions should you take Each correct answer presents part of the solution Choose two Add arguments to the Get Certkiller declaration to accept System Object and System EventArgs Add arguments to the check Certkiller Button Click declaration to accept System Object and System EventArgs Add code to Get Certkiller to call check Certkiller Button Click Add the following code segment at the end of the Get Certkiller declaration Handles check Certkiller Button Click Add the following code segment at the end of the check Certkiller Button Click procedure Handles Get Certkiller Answer B D QUESTION You use Visual Studio NET to create a Windows-based application for Certkiller Inc The application enables users to update customer information that is stored in a database Your application contains several text boxes All TextBox controls are validated as soon as focus is transferred to another control However your validation code does not function as expected To debug the application you place the following line of code in the Enter event handler for the first text box You repeat the process for the Leave Validated Validating and TextChanged events In each event the text is displayed in the output window contains the name of the event being handled You run the application and enter a value in the first TextBox control Then you change focus to another control to force the validation routines to run Which code segment will be displayed in the Visual Studio NET output windows Enter Validating TextChanged Leave Validated Enter TextChanged Leave Validating Validated Enter Validating Validated TextChanged Leave Enter TextChanged Validating Validated Leave Enter Validating TextChanged Validated Leave Answer B QUESTION You create the user interface for a Windows-based application The main form in your application includes an Exit menu item named exitItem and an Exit button named exitCommand You want the same code to run whether the user clicks the menu item or the button You want to accomplish this goal by writing the shortest possible code segment Which code segment should you use private void HandleExit object sender System EventArgs e Insert application exit code private void MainForm Load object sender System EventArgs e this exitCommand Click new System EventHandler HandleExit this exitItem Click new System EventHandler HandleExit private void HandleExit object sender System EventArgs e Insert application exit code private void MainForm Load object sender System EventArgs e new System EventHandler HandleExit new System EventHandler HandleExit private void HandleExit Insert application exit code private void MainForm Load object sender System EventArgs e this exitCommand Click new System EventHandler HandleExit this exitItem Click new System EventHandler HandleExit private void exitCommand Click object sender System EventArgs e Insert application exit code private void exitItem Click object sender System EventArgs e Insert application exit code Answer A QUESTION You develop an application that includes a Contact Class The contact class is defined by the following code public class Contact private string name public event EventHandler ContactSaved public string Name get return name set name value public void Save Insert Save code Now raise the event OnSave public virtual void OnSave Raise the event if ContactSaved null ContactSaved this null You create a form named Certkiller Form This form must include code to handle the ContactSaved event raised by the Contact object The Contact object will be initialized by a procedure named CreateContact Which code segment should you use private void HandleContactSaved Insert event handling code private void CreateContact Contact oContact new Contact oContact ContactSaved new EventHandler HandleContactSaved oContact Name Certkiller oContact Save private void HandleContactSaved object sender EventArgs e Insert event handling code private void CreateContact Contact oContact new Contact oContact Name Certkiller oContact Save private void HandleContactSaved object sender EventArgs e Insert event handling code private void CreateContact Contact oContact new Contact oContact ContactSaved new EventHandler HandleContactSaved oContact Name Certkiller oContact Save private void HandleContactSaved Object sender EventArgs e Insert event-handling code private void CreateContact Contact oContact new Contact new EventHandler HandleContactSaved oContact Name Certkiller oContact Save Answer C Explanation The delegate is correctly declared with appropriate parameters private void HandleContactSaved object sender EventArgs e The association between the delegate and the event is correctly created with the operator oContact ContactSaved new EventHandler HandleContactSaved Note An event handler is a method that is called through a delegate when an event is raised and you must create associations between events and event handlers to achieve your desired results In C the operator is used to associate a delegate with an event Reference - - Training kit Implementing Event Handlers Pages - Incorrect Answers The declaration of the delegate do not contain any parameters private void HandleContactSaved There is no association made between the delegate and the event D The association between the delegate an the event is incorrect The operator must be used new EventHandler HandleContactSaved QUESTION You use Visual Studio NET to create a component named Request This component includes a method named AcceptCKRequest which tries to process new user requests for services AcceptCKRequest calls a private function named Validate You must ensure that any exceptions encountered by Validate are bubbled up to the parent form of Request The parent form will then be responsible for handling the exceptions You want to accomplish this goal by writing the minimum amount of code What should you do Use the following code segment in AcceptCKRequest this Validate Use the following code segment in AcceptCKRequest try this Validate catch Exception ex throw ex Use the following code segment in AcceptCKRequest try this Validate catch Exception ex throw new Exception Exception in AcceptCKRequest ex Create a custom Exception class named RequestException by using the following code segment public class RequestException ApplicationException public RequestException base public RequestException string message base message public RequestException string message Exception inner base message inner In addition use the following code segment in AcceptCKRequest try this Validate catch Exception ex throw new RequestException Exception in AcceptCKRequest ex Answer A Explanation The unhandled exception automatically will be thrown to the client application This solution meets the requirement that the least amount of code should be used Not B Options A and B produce the same result Option A is better solution because of minimized coding Catching and just throwing an exception in the catch block without any additional processing is meaningless QUESTION You use Visual Studio NET to create a Windows-based application The application includes a form named Certkiller You implement print functionality in Certkiller by using the native NET System Class Libraries Certkiller will print a packing list on tractor-fed preprinted forms The packing list always consists of two pages The bottom margin of page is different from the bottom margin of page You must ensure that each page is printed within the appropriate margins What should you do When printing page set the bottom margin by using the PrintPageEventArgs object When printing page set the bottom margin by using the QueryPageSettingEventArgs object Before printing set the bottom margin of page by using the PrintSetupDialog object Before printing set the bottom margin of page by using the PrinterSettings object Answer B Explanation It is possible to print each page of a document using different page settings You set page settings by modifying individual properties of the QueryPageSettingsEventArgs PageSettings property Changes made to the PageSettings affect only the current page not the document's default page settings The PageSettings Class specifies settings that apply to a single printed page It is used to specify settings that modify the way a page will be printed Reference NET Framework Class Library PrintDocument PrintPage Event NET Framework Class Library PrintDocument QueryPageSettings Event C NET Framework Class Library PrintDocument PrintPage Event C Incorrect Answers A The pageSettings property of PrintPageEventArgs is read only PrintSetupDialog object cannot be used to specify specific print settings of page The PrinterSettings object sets general Printer properties It does no apply here QUESTION You use Visual Studio NET to create a Windows-based application The application includes a form named Certkiller Procedures CKP CKP allows users to enter very lengthy text into a database When users click the Print button located on CKP this text must be printed by the default printer You implement the printing functionality by using the native NET System Class Libraries with all default settings Users report that only the first page of the text is being printed How should you correct this problem In the BeginPrint event set the HasMorePages property of the PrintEventArgs object to True In the EndPrint event set the HasMorePages property of the PrintEventArgs object to True In the PrintPage event set the HasMorePages property of the PrintPageEventArgs object to True In the QueryPageSettings event set the HasMorePages property of the QueryPageSettingEventArgs object to True Answer C Explanation PrintDocument PrintPage Event occurs when the output to print for the current page is needed This event has the HasMorePages property which gets or sets a value indicating whether an additional page should be printed Reference NET Framework Class Library PrintDocument Class Visual Basic NET Framework Class Library PrintDocument PrintPage Event Visual Basic QUESTION You are a developer for a Certkiller Inc that provides free software over the Internet You are developing en e-mail application that users all over the world can download The application displays text strings in the user interface At run time these text strings must appear in the language that is appropriate to the locale setting of the computer running the application You have resources to develop versions of the application for only four different cultures You must ensure that your application will also be usable by people of other cultures How should you prepare the application for deployment Package a different assembly for each culture Package a different executable file for each culture Package a main assembly for source code and the default culture Package satellite assemblies for the other cultures D Package a main assembly for source code Package satellite assemblies for each culture Answer C Explanation When you build a project the resource files are compiled and then embedded in satellite assemblies or assemblies which contain only the localized resources The fallback resources are built into the main assembly which also contains the application code Reference Visual Basic and Visual C Concepts What's New in International Applications Visual Basic and Visual C Concepts Introduction to International Applications in Visual Basic and Visual C Incorrect Answers A main assembly is needed Assemblies not executables are used D The main assembly contains the fallback resources including default culture QUESTION You use the NET Framework to develop a new Windows-based application The application includes a COM component that you created Certkiller com company policy requires you to sign the Certkiller Op assembly with a strong name However issues of company security require that you delay signing the assembly for one month You need to begin using the application immediately on a pilot basis You must achieve your goal with the least possible effort What should you do Create a reference to the COM component through the Visual Studio NET IDE Create the Certkiller Op assembly by using the Type Library Importer Tlbimp exe Create the Certkiller Op assembly by using the TypeLibConverter class in the System Runtime Certkiller OpServices namespace Create a custom wrapper by creating a duplicate definition or interface of the class in managed source code Answer B Explanation The easiest way to do this is by delayed signing with Tlbimp exe option B QUESTION You use Visual Studio NET to create several Windows-based applications All use a common class library assembly named Certkiller Customers You deploy the application to client computers on your company intranet Later you modify Certkiller Customers Any application that uses version must now user version What should you do Modify the machine configuration file on your client computers Modify the application configuration file for Customers Modify the Publisher Policy file containing a reference to Customers Modify the reference patch for Customers Answer C Explanation When an assembly vendor releases a new version of an assembly the vendor can include a publisher policy so applications that use the old version now use the new version Reference NET Framework General Reference publisherPolicy Element QUESTION Your company uses Visual Studio NET to create a Windows-based application for Certkiller The application is named CustomerTracker and it calls an assembly named Schedule Six months pass The hospital asks your company to develop a new Windows-based application The new application will be named EmployeeTracker and it will also call Schedule Because you anticipate future revisions to this assembly you want only one copy of Schedule to serve both applications Before you can use Schedule in EmployeeTracker you need to complete some preliminary tasks Which three actions should you take Each correct answer presents part of the solution Choose three Create a strong name for Schedule Use side-by-se execution to run Schedule Install Schedule in the global assembly cache Move Schedule to the Windows System folder Create a reference in EmployeeTracker to Schedule Create a reference in EmployeeTracker to CustomerTracker Answer A C E Explanation A An assembly must have a strong name to be installed in the global assembly cache C You intend to share an assembly among several applications you can install it into the global assembly cache E We must create a reference from the application EmployeeTracker to the assembly Schedule Reference NET Framework Developer's Guide Working with Assemblies and the Global Assembly Cache NET Framework Developer's Guide Side-by-Side Execution Incorrect Answers B Side-by-side execution is the ability to run multiple versions of the same assembly simultaneously It is not required in this scenario D The assembly should be moved to the global assembly cache not to the Windows System folder F The application should reference the assembly not the first application QUESTION You use Visual Studio NET to create an assembly that will be consumed by other Visual Studio NET applications No Permissions should be granted to this assembly unless the assembly makes a minimum permission request for them Which code segment should you use Assembly PermissionSet SecurityAction PermitOnly Unrestricted True Assembly PermissionSet SecurityAction PermitOnly Unrestricted False Assembly PermissionSet SecurityAction RequestOptional Unrestricted True Assembly PermissionSet SecurityAction RequestOptional Unrestricted False Answer D Explanation The RequestOptional SecurityAction requests for additional permissions that are optional not required to run This action can only be used within the scope of the assembly The code needs only the minimum set of permissions and no others It should not be granted any optional permissions that it has not specifically requested We must therefore use Unrestricted False Reference NET Framework Developer's Guide Requesting Optional Permissions Incorrect Answers A B The PermitOnly SecurityAction does not support Assembly as a target it only supports Class or Method as targets C The assembly must only be granted minimal permissions It should not be granted any optional permissions that it has not specifically requested QUESTION You use Visual Studio NET to create an application that uses an assembly The assembly will reside on the client computer when the application is installed You must ensure that any future applications installed on the same computer can access the assembly Which two actions should you take Each correct answer presents part of the solution Choose two Use XCOPY to install the assembly in the global assembly cache Use XCOPY to install the assembly in the Windows Assembly folder Create a strong name for the assembly Recompile the assembly by using the Native Image Generator Ngen exe Modify the application configuration file to include the assembly Use a deployment project to install the assembly in the global assembly cache Use a deployment project to install the assembly in the Windows System folder Answer C F Explanation The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer C An assembly must have a strong name to be installed in the global assembly cache F There are two ways to install an assembly into the global assembly cache Using Microsoft Windows Installer This could be achieved by a deployment project Using the Global Assembly Cache tool Gacutil exe This is not an option here 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 QUESTION You use Visual Studio NET to create a control that will be used on several forms in your application It is a custom label control that retrieves and displays your company's current stock price The control will be displayed on many forms that have different backgrounds You want the control to show as much of the underlying form as possible You want to ensure that only the stock price is visible The rectangular control itself should not be visible You need to add code to the Load event of the control to fulfill these requirements Which two code segments should you use Each correct answer presents part of the solution Choose two ContextMenu MenuItems Clear ContextMenu MenuItems Add Display Help ContextMenu MenuItems Add helpCKOption CloneMenu ContextMenu MenuItems Click new System EventHandler helpCKOption Click this SetStyle ControlStyles SupportsTransparentBackColor true Answer A E Explanation To give your control a transparent backcolor Call the SetStyle method of your form in the constructor this setStyle ControlStyles SupportsTransparentBackColor This will enable your control to support a transparent backcolor Beneath the line of code you added in step add the following line This will set your control's BackColor to Transparent this Backcolor color Transparent Reference Visual Basic and Visual C Concepts Giving Your Control a Transparent Background QUESTION You are developing a Windows-based application that logs hours worked by Certkiller employees Your design goals require you to maximize application performance and minimize impact on server resources You need to implement a SqlCommand object that will send a SQL INSERT action query to a database each time a user makes a new entry To create a function named LineItemInsert you write the following code Line numbers are included for reference only public int LineItemInsert int empID int projectID decimal hrs SqlConnection cnn string SQL int Ret SQL String Format INSERT INTO TimeEntries EmpID ProjectID Hours VALUES empID project ID hrs SqlCommand cmd new SqlCommand SQL cnn Insert new code You code must execute the SQL INSERT action query and verify the number of database records that are affected by the query Which code segment should you add on line cnn Open Ret cmd ExecuteNonQuery cnn Close return Ret cnn Open Ret cmd ExecuteScalar cnn Close return Ret SqlDataReader reader cnn Open reader cmd ExecuteReader cnn Close return reader RecordsAffected SqlDataReader reader cnn Open reader cmd ExecuteReader cnn Close return reader GetValue Answer A QUESTION You develop a Windows-based application You plan to use ADO NET to call a Microsoft SQL Server stored procedure named Certkiller EmployeeData This procedure accepts a parameter for querying the database by an employee's family name You need to add code to your application to set up the parameter for use with the stored procedure Which three lines of code should you add Each correct answer presents part of the solution Choose three SqlParameter prm new SqlParameter SqlParameter prm new SqlParameter FamilyName SqlDbType VarChar prm Direction ParameterDirection Input prm Direction ParameterDirection InputOutput cmd Parameters Add prm cmd Parameters prm Answer B C E QUESTION You develop a Windows- based application that accesses a Microsoft SQL Server database The application includes a form named CustomerForm which contains a Button control named SortButton The database includes a table named Customers Data from Customers will be displayed on CustomerForm by means of a DataGrid control named DataGrid The following code segment is used to fill DataGrid private void FillDataGrid SqlConnection cnn new SqlConnection server localhost uid sa pwd database Certkiller Sales SqlDataAdapter da new SqlDataAdapter SELECT CKCustomerID ContactName CITY FROM Customers cnn DataSet ds new DataSet da MissingSchemaAction MissingSchemaAction AddWithKey da Fill ds Customers DataView dv new DataView ds Tables Customers dv Sort City ASC ContactName ASC dv ApplyDefaultSort true dataGrid DataSource dv The primary key for Customers is the CKCustomerID column You must ensure that the data will be displayed in ascending orderby primary key when the user selects SortButton What should you do Set the Sort property of the DataView object to an empty string Set the ApplyDefaultSort property of the DataView object to False Include an ORDER BY clause in the SELECT statement when you create the Data Adapter object Set the RowFilter property of the DataView object to CustomerID Answer A Explanation The data view definition includes the follow command dv sort city ASC contactName ASC This enforces sorting on the City and the ContactName columns It overrides the default sort order We must set the Sort property to an empty string This would enable the default sort order Reference Visual Basic and Visual C Concepts Filtering and Sorting Data Using Data Views Incorrect Answers By default a view is sorted on the Primary Key in ascending order We would to set the ApplyDefaultSort to true not to false A ORDER BY clause cannot be used in a view The RowFilter property does not affect the sort configuration QUESTION You develop a Windows-based application to manage inventory for Certkiller inc The application calls a Microsoft SQL Server stored procedure named sp UpdatePrices sp UpdateCKPrices performs a SQL UPDATE statement that increases prices for selected items in an inventory table It returns an output parameter named totalprice and a result set that contains all of the records that were updated totalprice contains the sum of the prices of all items that were updated You implement a SqlCommand object that executes sp UpdateCKPrices and returns the results to a SqlDataReader object The SqlDataReader object gives you access to the data in the result set Which is displayed in a list box on your Windows Form The value of totalprice must also be displayed in a text box on your Windows Form You need to write code that will retrieve this value Which code segment should you use A While reader Read TextBox Text com parameters ' totalprice value ToString reader close B do TextBox Text com parameters totalprice Value ToString While reader Read reader close C TextBox Text com parameters totalprice value ToString reader close D reader close TextBox Text com parameters totalprice value ToString A cmd executeNonQuery Answer D Explanation The correct answer is D the output parameter is not available until after the reader is closed QUESTION You develop an inventory management application for Certkiller The application uses a SqlDataReader object to retrieve a product code list from a database The list is displayed in a drop-down list box on a Windows Form The Form Load procedure contains the following code Line numbers are included for reference only public void ReadMyData String ConnectionString String query SELECT CatID CatName FROM Certkiller Categories SqlConnection cnn new SqlConnection ConnectionString SqlCommand cmd new SqlCommand query cnn SqlDataReader reader cnn Open Insert new code cnn Close To enable your application to access data from the SqlDataReader object you need to insert additional code on line Your insertion must minimize the use of database server resources without adversely affecting application performance Which code segment should you use reader cmd ExecuteReader while reader Read ListBox Items Add reader GetString reader NextResult reader cmd ExecuteReader while reader Read ListBox Items Add reader GetString C reader cmd ExecuteReader while reader Read ListBox Items Add reader GetString reader Close D reader cmd ExecuteReader while reader Read ListBox Items Add reader GetString reader NextResult reader Close Answer C Explanation If there is a record available the Read Method advances the DataReader to next record and returns true If no records are available it returns false The while loop adds one list item for each record Finally we must close the DateReader with the Close method Reference - - Training kit Simple Data Access with the DataReader Pages - - - Training kit Using Multiple Result Sets Pages - Incorrect Answers A D The NextResult method is used to retrieve the next result set This is used when the Command object contains multiple SQL statements NextResult executes the next SQL Statement in the Command object A multiple result set is not used to populate a list box B We must always close the DateReader when we are finished with it QUESTION You develop a Windows-based application Certkiller Invoice that enables users to enter and edit customer orders Certkiller Invoice contains a DataSet object named orderEntryDataSet and DataTable object named orderDataTable and orderDetailDataTable The orderDetailDataTable requires two columns to make a unique primary key You need to define a primary key for orderDetailDataTable What should you do Set the DataTable PrimaryKey property to a string value that lists the column names that make the primary key Set the DataTable PrimaryKey property to an array of DataColumn objects that reference the columns that make the primary key Iterate through the DataTable Columns collection and set the DataType property of the columns that make the primary key Create a UniqueConstraint on the columns that make the primary key Answer B Explanation DataTable PrimaryKey Property gets or sets an array of columns that function as primary keys for the data table Reference NET Framework Class Library DataTable PrimaryKey Property C Incorrect Answers A An array of columns not a string value is used with the PrimaryKey property There can be only one primary key in a DataTable The PrimeryKey property not the UniqueConstraint must be used The PrimaryKey property enforces uniqueness as well QUESTION You develop a Windows-based customer service application that includes a search feature Users will enter characters in a text box to look up customer information by family name For convenience users must be able to perform a search by entering only the first few characters of the family name To enable this functionality your application will capture the users input and stores it in a variable named CKName Your application must then submit a Microsoft SQL Server query to the central customer service database How should you write the query SQL SELECT PersonalName FamilyName FROM Customers WHERE FamilyName ' CKName ' SQL SELECT PersonalName FamilyName FROM Customers WHERE FamilyName LIKE ' CKName ' SQL SELECT PersonalName FamilyName FROM Customers WHERE FamilyName ' CKName ' SQL SELECT PersonalName FamilyName FROM Customers WHERE FamilyName LIKE ' CKName ' Answer B Explanation The SQL server LIKE Transact-SQL command LIKE determines whether or not a given character string matches a specified pattern is used as a wildcard character Reference SQL Server Books Online LIKE Incorrect Answers A We must use the LIKE keyword We must use the LIKE keyword with the wildcard character not is used as a wildcard character QUESTION You develop a Windows-based application for tracking telephone calls The application stores and retrieves data by using a Microsoft SQL Server database You will use the SQL Client managed provider to connect and send commands to the database You use integrated security to authenticate users Your server is called Certkiller and the database name is CustomerService You need to set the connection string property of the SQL Connection object Which code segment should you use Provider SQLOLEDB Data Source Certkiller Initial Catalog CustomerService Provider MSDASQL Data Source Certkiller Initial Catalog CustomerService Data Source Certkiller Initial Catalog Master Data Source Certkiller Initial Catalog CustomerService Answer D Explanation We simply specify the name of the server as Data Source and the name of database as Initial Catalog Reference NET Framework Class Library OleDbConnection ConnectionString Property C Incorrect Answers We are using SQL Client Object so we cannot use a Provider tag We are using SQL Client Object so we cannot use a Provider tag Furthermore theMSDASQL provider is used for Oracle databases not for Microsoft SQL Server databases The database name is CustomerService not Master QUESTION You develop a Windows-based application that interacts with a Microsoft SQL Server database The application inserts new rows into the database by calling the following stored procedure Line numbers are included for reference only ALTER PROCEDURE dbo sp Update Certkiller Price category int totalprice money OUTPUT AS SET NOCOUNT ON UPDATE Products SET UnitPrice UnitPrice WHERE CategoryID category SELECT totalprice sum UnitPrice FROM Products SELECT ProductName FROM Products WHERE CategoryID category RETURN Totalprice You application uses the ExecuteReader method of the SqlCommand object to call the stored procedure and create a SqlDataReader object After the stored procedure runts your code must examine the SqlDataReader RecordsAffected property to verify that the correct number of records is successfully updated However when you execute the stored procedure the SqlDataReader RecordsAffected property always returns - How should you correct this problem Change line to SET ROWCOUNT Change line to SET NOCOUNT OFF Change line to RETURN Change line to RETURN category Answer B Explanation SqlDataReader RecordsAffected Property gets the number of rows changed inserted or deleted by execution of the Transact-SQL statement The Transact-SQL SET NOCOUNT command stops the message indicating the number of rows affected by a Transact-SQL statement from being returned as part of the results When SET NOCOUNT is ON the count indicating the number of rows affected by a Transact-SQL statement is not returned When SET NOCOUNT is OFF the count is returned Reference SQL Server Books Online SET NOCOUNT NET Framework Class Library SqlDataReader RecordsAffected Property Visual Basic Incorrect Answers A The SET NOCOUNT is incorrect We should use OFF instead of C D We cannot change the functionality of the stored procedure by changing the RETURN statement Furthermore returning or the value of Category value does not achieve the desired result QUESTION You develop an inventory management application called Certkiller Management that will call a Microsoft SQL Server stored procedure named sp GetDaily Certkiller Sales The stored procedure will run a query that returns your daily sales total as an output parameter This total will be displayed to users in a message box Your application uses a SqlCommand object to run sp GetDaily Certkiller Sales You write the following code to call sp GetDaily Certkiller Sales sql Connection cnn new sqlConnection myConnString cmd CommandType CommandType StoredProcedure SqlParameter prm cmd Parameters Add ItemTotal SqlDbType Int prm Direction ParameterDirection Output cnn Open cmd ExecuteNonQuery Now you must write additional code to access the output parameter Which code segment should you use MessageBox Show Total is cmd Parameters Output Value ToString MessageBox Show Total is cmd Parameters Output ToString MessageBox Show Total is cmd Parameters ItemTotal Value ToString MessageBox Show Total is cmd Parameters ItemTotal ToString Answer C Explanation The ItemTotal parameter is declared as an output parameter with SQL Server data type INT We use the Value property of the SQLParameter class to retrieve the value of this parameter We must also convert the INT value to a string value with the ToString method We then supply this string to the MessageBox Show method Reference NET Framework Class Library SqlParameter Class C NET Framework Class Library SqlParameter Direction Property C NET Framework Class Library SqlParameter SqlDbType Property C NET Framework Class Library SqlParameter Value Property C Incorrect Answers A B The ItemTotal parameter is the output parameter Using Output this way is incorrect Output is a keyword and no variable named Output has been declared D We must use the Value method to retrieve the value of the parameter QUESTION You develop an enterprise application called Certkiller Application that includes a Windows Form presentation layer middle-tier components for business logic and data access and a Microsoft SQL Server database You are in the process of creating a middle-tier component that will execute the data access routines in your application When data is passed to this component the component will call several SQL Server stored procedures to perform database updates All of these procedure calls run under the control of a single transaction The code for the middle- tier component will implement the following objects SqlConnection cn new SqlConnection SqlTransaction tr If two users try to update the same data concurrently inconsistencies such as phantom reads will occur You must now add code to your component to specify the highest possible level of protection against such inconsistencies Which code segment should you use tr cn BeginTransaction ReadCommitted tr cn BeginTransaction IsolationLevel ReadCommitted tr cn BeginTransaction IsolationLevel Serializable tr cn BeginTransaction Serializable Answer C Explanation Serializable is the highest isolation transaction level It provide the highest possible level of protection against concurrent data errors The correct syntax to begin a transaction with this transaction isolation level is cn BeginTransaction IsolationLevel Serializable Reference NET Framework Class Library SqlConnection BeginTransaction Method IsolationLevel C NET Framework Class Library IsolationLevel Enumeration C Incorrect Answers Incorrect syntax The ReadCommitted transaction isolation level can result in in non-repeatable reads or phantom data It does not give the highest possible protection from parallel updates Incorrect syntax QUESTION As a software developer at Certkiller Inc you use Visual Studio NET to develop a Windows-based application that will manage vendor contracts You create a DataSet object along with its associated DataTable object and DataView object The DataSet object contains all data available for a single contract This data is displayed in a DataGrid control After all parties sign a contract the value in a field named ContractApproved is set to True Business rules prohibit changes to database information about a contract when the ContractApproved value associated with the contract is true You must ensure that this business rule is enforces by your application code What should you do Set the AllowNew property of the DataSet object to False Set the AllowEdit property of the DataView object to False Call the EndEdit method of the DataTable object Call the EndEdit method of the DataRow object Answer B QUESTION You develop an orderentry application Certkiller Order Certkiller Order uses a DataSet object named CurrentOrders to maintain data in memory while users modify the data To CurrentOrders you add DataTable object named Orders and OrderDetails OrderDetails contains data about each line item that is included in the order Users frequently discover that an ordercontains no entries in OrderDetails In these situations they delete the orderfrom Orders You must ensure that users cannot delete any orders that have corresponding entries in OrderDetails What should you do Add a UniqueConstraint object to CurrentOrders Add a ForeignKeyConstraint object to CurrentOrders Add a DataRelation object to CurrentOrders and set the ChildKeyConstraint property to point to the appropriate column Add a DataRelation object to CurrentOrders and set the ParentKeyConstraint property to the appropriate column Answer B QUESTION You need to create an OleDbCommand object to retrieve information about postal codes for your mailing list application You create an OleDbConnection object named conn You need to instantiate the OleDbCommand object and set the CommandText and Connection properties What are two possible code segments for you to use Each correct answer presents a complete solution Choose two OleDbCommand comm new OleDbCommand comm CommandText SELECT FROM Regions comm Connection conn OleDbCommand comm new OleDbCommand sp GetRegions conn comm CommandType CommandType Text OleDbCommand comm new OleDbCommand SELECT FROM Regions conn comm CommandType CommandType Text OleDbCommand comm new OleDbCommand sp GetRegions conn comm CommandType CommandType TableDirect OleDbCommand comm new OleDbCommand comm CommandType SELECT FROM Regions comm Connection conn Answer A C QUESTION You develop a Windows-based application Certkiller App by using Visual Studio NET Certkiller App implements ADO NET objects to call Microsoft SQL Server stored procedures Your database administrator is responsible for coding and maintaining all stored procedures Periodically the administrator modifies the stored procedures At run time your application code must discover any changes in the way that values are passed to and returned from the stored procedures Which ADO NET object and method should you use CommandBuilder RefreshSchema CommandBuilder DeriveParameters SqlCommand CreateParameter SqlDataAdapter GetFillParameters Answer B QUESTION You use Visual Studio NET to develop a Windows-based application that will interact with a Microsoft SQL Server database Your application will display employee information from a table named Certkiller Employees You use ADO NET to access the data from the database To limit the possibility of errors you must ensure that any type of mismatch errors between your application code and the database are caught at compile time rather than at run time Which two actions should you take Each correct answer presents part of the solution Choose two Create an XML schema for Certkiller Employees Create an XML style sheet for Certkiller Employees Create an XML namespace for Certkiller Employees Create a typed DataSet object based on the XML schema Create a typed DataSet object based on the XML style sheet Create a TypeDelegator class based on the XML namespace Answer A D Explanation A We need to create an XML schema that describes the structure of the data D From this XML schema we can create a typed DataSet object Incorrect Answers B E There is no such thing as an XML style sheet C Namespaces are used to enable shorthand notation of objects It does not apply here F Delegates are used for the managed code objects to encapsulate method calls TypeDelagators do not apply here QUESTION You develop a Windows-based application named Certkiller Payroll Your application receives information in the form of an XML data file named dataFile This file does not include any schema information You need to write code to load the XML data into a DataSet object Which code segment should you use DataSet ds new DataSet CKPayrollData ds ReadXml dataFile XmlReadMode IgnoreSchema DataSet ds new DataSet CKPayrollData ds ReadXml datafile XmlReadMode InferSchema DataSet ds new DataSet CKPayrollData ds ReadXml dataFile XmlReadMode ReadSchema DataSet ds new DataSet CKPayrollData ds ReadXml dataFile XmlReadMode Fragment Answer B Explanation The InferSchema XMLReadMode ignores any inline schema infers schema from the data and loads the data Reference NET Framework Class Library XmlReadMode Enumeration C Incorrect Answers A The IgnorSchema XMLReadMode ignores any inline schema and reads data into the existing DataSet schema However there exists to schema in this scenario The ReadSchema XMLReadMode reads any inline schema and loads the data The IgnorSchema XMLReadMode reads XML documents against an instance of SQL Server but we are reading data from a file QUESTION You develop a Windows-based order entry application Certkiller Entry by using Visual Studio NET Certkiller Entry includes a DataSet object When a customer order exceeds the number of items currently available in stock Certkiller Entry must create two separate entries in a database The first entry specifies the total number of items in the customer order as well as the number of items that can be supplied immediately from available stock The second entry records backorder information and specifies the number of items that must be supplied when new stock becomes available Backorder processing is handled by a separate component You must ensure that all orderinformation in the DataSet object is captured and passed to this component To do so you need to create a new DataSet object Which method should you use DataSet Clone DataSet Copy DataSet Merge DataSet GetChanges Answer D Explanation The DataSet GetChanges Method gets a copy of the DataSet containing all changes made to it since it was last loaded It meets the requirement of this scenario Reference NET Framework Class Library DataSet Copy Method C NET Framework Class Library DataSet Clone Method C NET Framework Class Library DataSet GetChanges Method C Incorrect Answers The DataSet Clone method copies the structure of the DataSet including all DataTable schemas relations and constraints However it does not copy any data DataSet Copy method copies both the structure and data for this DataSet But we are only interested in the changes We want to create a new DataSet object not merge two existing objects QUESTION You develop a contact management application called Certkiller Management that will enable users to retrieve information from a central database After the data is returned to Certkiller Management users must be able to view it edit it add new records and delete existing records All user changes must then be saved in the database Certkiller Management design requires several ADO NET objects to work together to accomplish these requirements You use classes from the System Data and System Data OleDb namespaces First you write the code to connect to the database Which four actions should you take next Each correct answer presents part of the solution Choose four Create an OleDbDataAdapter object and define the SelectCommand property Create an OleDbCommand object and use the ExecuteScalar method Create a DataTable object as a container for the data Create a DataSet object as a container for the data Call the DataAdapter Fill method to populate the DataSet object Call the DataAdapter Update method to populate the DataSet object Call the DataAdapter Update method to save changes to the database H Call the DataSet AcceptChanges method to save changes to the database Answer A D E G Explanation A First we must create a DataAdapter We then use a DataSet object as a container for the data We use the Fill method to populate the DataSet Finally we update the data source with the Update method Reference Visual Basic and Visual C Concepts Introduction to Dataset Updates NET Framework Developer's Guide Using NET Data Providers to Access Data NET Framework Class Library DbDataAdapter Fill Method Visual Basic NET Framework Developer's Guide Updating the Database with a DataAdapter and the DataSet Visual Basic Incorrect Answers We need a DataAdapter to populate the DataSet DataTables contains the actual data We must a DataSet instead A DataSet is an in-memory representation of relational data The Fill method not the Update method is used to populate the DataSet The AcceptChanges method is to commit the pending changes to the Dataset not to the data source the database QUESTION You develop a Windows-based application that enables users to update customer contact information Your application uses a DataSet object to maintain the customer data while users are reviewing and editing it When a user finishes updating the data your application uses the DataSet WriteXml method to create an XML data file The tag name of the root element of the XML data file must be Certkiller CustomerInfo You need to add code to your application to ensure that this tag name is set correctly Which code segment should you use dsCustomer Namespace Certkiller CustomerInfo dsCustomer New DataSet Certkiller CustomerInfo dcCustomer Prefix Certkiller CustomerInfo dsCustomer WriteXml Certkiller CustomerInfo Answer B Explanation The DataSet Namespace Property gets or sets the namespace of the DataSet The Namespace property is used in the root element of the XML data file generated from the dataset Reference NET Framework Class Library DataSet Namespace Property C NET Framework Class Library DataSet WriteXml Method XmlWriter C NET Framework Class Library DataSet Prefix Property C Incorrect Answers The name of the dataset does not decide the name of the root element of the XML data file The DataSet Prefix Property gets or sets an XML prefix that aliases the namespace of the DataSet The Prefix is used throughout an XML document to identify elements which belong to the namespace of the DataSet object as set by the Namespace property The WriteXml method requires a XmlWriter parameter not a Text parameter QUESTION You develop a customer contact application Certkiller Contact that will enable users to view and update customer data in a Windows Form Your application uses a DataTable object and a DataAdapter object to manage the data and interact with a central database Your application design must fulfill the following requirements After a user completes a set of updates the changes must be written in the database The data stored in the DataTable object must indicate that the database updates are complete What code segment should you use DataTable AcceptChanges DataAdapter Update DataTable DataAdapter Update DataTable DataTable AcceptChanges DataTable Reset DataAdapter Update DataTable DataAdapter Update DataTable DataTable Reset Answer B Explanation First we resolve the changes update and then we commit them AcceptChanges Note The Update method of the DataAdapter is called to resolve changes from a DataSet back to the data source The DataAdapter analyzes the changes that have been made and executes the appropriate command INSERT UPDATE or DELETE The DataTable AcceptChanges Method commits all the changes made to this table since the last time AcceptChanges was called Reference NET Framework Class Library DataTable AcceptChanges Method C NET Framework Developer's Guide Updating the Database with a DataAdapter and the DataSet C NET Framework Class Library DataTable Reset Method C Incorrect Answers A We must first update the changes to the DataTable before we commit the data source We must swap the commands C D The DataTable Reset Method resets the DataTable to its original state We should instead commit all changes with the AcceptChanges method QUESTION Your development team is creating a Windows-based application for the Certkiller company The application asynchronously calls the ProcessLoan method of an XML Web service The XML Web service will notify your code when it finished executing ProcessLoan You must ensure that your code can continue processing while waiting for a response from the XML Web service Your code must establish when ProcessLoan finished executing What should your application do Use the WaitHande WaitAny method of the IAsyncResult AsyncWaitHandle object Examine the value of IAsyncResult IsCompleted to see if ProcessLoan is finished executing Use the WaitHandle WaitAll method of the IAsyncResult AsyncWaitHandle object Examine the value of IAsyncResult IsCompleted to see of ProcessLoan is finished executing Supply a callback delegate to the BeginProcessLoan method of the XML Web service After the XML Web service returns its response a thread will invoke the callback from the threadpool Supply a callback delegate to the EndProcessLoan method of the XML Web service After the XML Web service returns it response a thread will invoke the callback from the threadpool Answer C Explanation Calling an XML Web service asynchronously is a two-step operation The first step calling the Begin method initiates the XML Web service call The second step calling the End method completes the XML Web service call and returns the XML Web service response There are different methods to determine when the asynchronous XML Web service call has completed The preferred and most efficient method is to supply a callback delegate to the Begin method Reference Visual Basic and Visual C Concepts Accessing an XML Web Service Asynchronously in Managed Code Incorrect Answers A C It is possible to use IAsyncResult AsyncWaitHandle object to determine when the asynchronous XML Web service call has completed This is less efficient though D The callback delegate should be supplied to the Begin method not the End method QUESTION You develop a Windows-based application named Certkiller Purchase that exchanges data with an accounting application Purchase receives purchase order data from the accounting application in XML format Users of Certkiller Purchase review and edit the data Certkiller Purchase maintains the data in a DataSet object while users are working When they are finished making changes Certkiller Purchase must create an output file that will be returned to the accounting application For verification and auditing purposes the accounting application must receive both the user changes and the original values Now you need to write code that will create the output file What should you do A Call the DataSet WriteXmlSchema method and specify a TextWriter object as the argument B Call the DataSet WriteXmlSchema method and specify an XmlWriter object as the argument Call the DataSet WriteXml method and specify WriteSchema as the XmlWriteMode parameter Call the DataSet WriteXml method and specify DiffGram as the XmlWriteMode parameter Answer D Explanation A DiffGram is an XML format that is used to identify current and original versions of data elements Here we use the DataSet WriteXml method with the Diffgram XmlWriteMode to write the entire DataSet as a DiffGram including original and current values Reference NET Framework Developer's Guide DiffGrams NET Framework Developer's Guide Writing a DataSet as XML Data C Incorrect Answers A B We want to write the Dataset in XML format not as an XML schema C The WriteSchema XmlWriteMode writes only the current contents of the DataSet as XML data with the relational structure as inline XML Schema QUESTION You develop a Windows-based application called Certkiller Application by using Visual Studio NET Certkiller Application receives XML data files from various external suppliers An XML Schema file defines the format and the data types for the XML data files Certkiller Application must parse the incoming XML data files to ensure that they conform to the schema What should you do Implement a DataSet object and code an event handler to process its events Implement a DataSet object and set its Enforce Constraints property to True Implement an XmlValidatingReader object and code an event handler to process its events Implement an XmlValidatingReader object and examine its ReadState property after reading the XML data file Answer C Explanation The XmlValidatingReader class an implementation of the XmlReader class provides support for XML validation The ValidationEventHandler event is used to set an event handler for receiving information about schema validation errors Reference NET Framework Developer's Guide Validation of XML with XmlValidatingReader NET Framework Developer's Guide XmlValidatingReader Validation Event Handler Callback C QUESTION You develop a Windows -based application that creates XML output from a DataSet object The XML output is created by using the DataSet WriteXml method and then is sent to another application The second application requires the output to appear in the following format employee id name Certkiller JR age You need to write code to specify the format for the XML output Which code segment should you use ds WriteXml dataFile XmlWriteMode WriteSchema ds WriteXml dataFile XmlWriteMode IgnoreSchema foreach DataColumn dc in ds Tables employee Columns dc ColumnMapping MappingType Attribute foreach DataColumn dc in ds Tables employee Columns dc ColumnMapping MappingType Element Answer C Explanation We want to produce an attribute list with no tags The WriteSchema XmlWriteMode writes the current contents of the DataSet as XML data with the relational structure as inline XML Schema as is required in this scenario Reference NET Framework Class Library MappingType Enumeration NET Framework Developer's Guide Writing a DataSet as XML Data C NET Framework Class Library DataSet WriteXml Method C QUESTION You execute a query on your external Oracle database named Certkiller SalesDate by using an OleDbCommand object The query uses the Average function to return a single value that represents the average price of products in the inventory table You want to optimize performance when you execute this query To execute this query from your ADO NET code you need to use a method of the OleDbCommand object Which method should you use ExecuteNonQuery ExecuteScalar ToString ExecuteReader Answer B Explanation

Related Downloads
Explore
Post your homework questions and get free online help from our incredible volunteers
  1313 People Browsing
Your Opinion