


教育资源分享Exam : 070-316Title : Microsoft 70-316Developing Windows-based ApplicationsVer : 11-10-06教育资源分享,构建知识库QUESTION 1:070-316 You create a Windows Form named Certkiller Form. The form enables users tomaintain database records in a table named Certkiller .You need to add several pairs of controls to Certkiller Form. You must fulfill thefollowing requirements:1. Each pair of controls must represent one column in the Certkiller table.2. Each pair must consist of a TextBox control and a Label control.3. The LostFocus event of each TextBox control must call a procedure namedUpdateDatabase.4. Additional forms similar to Certkiller Form must be created for other tables in thedatabase.5. Application performance must be optimized.6. 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 theCertkiller 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 theCertkiller table has a pair of controls.Repeat this process for the other forms.C. 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 theCertkiller Form.Repeat this process for the other forms.D. 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 toCertkiller Form.Repeat this process for the other forms.Answer: CExplanation: We combine multiple Windows Form controls into a single control,called user control. This is the most efficient solution to reuse functionality in thisscenario.Note: Sometimes, a single control does not contain all of the functionality you need. Forinstance, you might want a control that you can bind to a data source to display a firstname, last name, and phone number, each in a separate TextBox. Although it is possibleSkyloong 微软解决方案专家认证 070-316 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 inmany different applications. Controls that contain multiple Windows Forms controlsbound together as a single unit are called user controls.Reference: 70-306/70-316 Training kit, Inheriting from UserControl, Page 345Incorrect AnswersA: Only the controls, not the code of the control will be copied.B: This is not the best solution. With a user control we could avoid writing code that areexecuted at run time.D: ActiveX controls should be avoided in Visual Studio .NET. They are less efficient.QUESTION 2:You use Visual Studio .NET to create a Windows-based application. The applicationcaptures screen shots of a small portion of the visible screen.You create a form named Certkiller CameraForm. You set theCertkiller CameraForm.BackColor property to Blue. You create a button on theform to enable users to take a screen shot.Now, you need to create a transparent portion of Certkiller CameraForm to frame asmall portion of the screen. Your application will capture an image of the screeninside the transparent area. The resulting appearance of CertK i ngCameraForm isshown 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 theSkyloong 微软解决方案专家认证 solution. Choose two.)A. Set transparentPanel.BackColor to Red.B. Set transparentPanel.BackColor to Blue.C. Set transparentPanel.BackgroundImage to None.D. Set transparentPanel.Visible to False.E. Set Certkiller CameraForm.Opacity to 0%.070-316 F. Set Certkiller CameraForm.TransparencyKey to Red.G. Set Certkiller CameraForm.TransparencyKey to Blue.Answer: A, FExplanation: 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 isBlue.QUESTION 3:You use Visual Studio .NET to create a Windows-based application. The applicationincludes a form named Certkiller Form.Certkiller Form contains 15 controls that enable users to set basic configurationoptions 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 isresized. The initial size of the form should be 650 x 700 pixels.If ConfigurationForm is resized to be smaller than 500 x 600 pixels, the controls willnot be displayed correctly. You must ensure that users cannot resizeConfigurationForm to be smaller than 500 x 600 pixels.Which two actions should you take to configure Certkiller Form? (Each correctanswer presents part of the solution. Choose two)A. Set the MinimumSize property to "500,600".B. Set the MinimumSize property to "650,700".C. Set the MinimizeBox property to True.D. Set the MaximumSize property to "500,600".E. Set the MaximumSize property to "650,700".F. Set the MaximumBox property to True.G. Set the Size property to "500,600".H. Set the Size property to "650,700".Answer: A, HExplanation: A: The Form.MinimumSize Property gets or sets the minimum size the form can beSkyloong 微软解决方案专家认证 resized to. It should be set to "500, 600".070-316 H: We use the size property to set the initial size of the form. The initial size should beset to "650, 700".Reference:.NET Framework Class Library, Form.MinimumSize Property [C#].NET Framework Class Library, Form.Size Property [C#]Incorrect AnswersB: The initial size is 650 x 750. The minimal size should be set to "500,600".C: 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.F: The maximize button will be displayed, but it will not affect the size of the form.G: The initial size should be 650 x 700, not 500 x 600.QUESTION 4:You use Visual Studio .NET to create a Windows-based application. The applicationincludes 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)A. Set CertK Form.MinimizeBox to False.B. Set CertK Form.MaximizeBox to False.C. Set CertK Form.ControlBox to False.D. Set CertK Form.ImeMode to Disabled.E. Set CertK Form.WindowState to Maximized.F. Set CertK Form.FormBorderStyle to one of the Fixed Styles.G. Set CertK Form.GridSize to the appropriate size.Answer: A, B, FExplanation: We disable the Minimize and Maximize buttons with theCertK 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 5:You use Visual Studio .NET to create a Windows-based application for Certkiller Inc. The application includes a form that contains several controls, including abutton named exitButton. After you finish designing the form, you select all controlsSkyloong 微软解决方案专家认证 070-316 and then select Lock Controls from the Format menu.Later, you discover that exitButton is too small. You need to enlarge its verticaldimension with the least possible effort, and without disrupting the other controls.First you select exitButton in the Windows Forms Designer. What should you donext? A. Set the Locked property to False.Set the Size property to the required size.Set the Locked property to True.B. Set the Locked property to False.Use the mouse to resize the control.Set the Locked property to True.C. Set the Size property to the required size.D. Use the mouse to resize the control.Answer: CQUESTION 6:You develop a Windows control named FormattedTextBox, which will be used bymany developers in your company Certkiller Inc. FormattedTextBox will be updatedfrequently.You create a custom bitmap image named CustomControl.bmp to representFormattedTextBox in the Visual Studio .NET toolbox. The bitmap contains thecurrent version number of the control, and it will be updated each time the controlis updated. The bitmap will be stored in the application folder.If the bitmap is not available, the standard TextBox control bitmap must bedisplayed instead.Which class attribute should you add to FormattedTextBox?A. [ToolboxBitmap(typeof(TextBox))[class FormattedTextBox B. [ToolboxBitmap(@"CustomControl.bmp")]class FormattedTextBox C. [ToolboxBitmap(typeof(TextBox), "CustomControl.bmp")]class FormattedTextBox D. [ToolboxBitmap(typeof(TextBox))][ToolboxBitmap(@"CustomControl.bmp")]class FormattedTextBox Answer: BExplanation: You specify a Toolbox bitmap by using the ToolboxBitmapAttributeclass. The ToolboxBitmapAttribute is used to specify the file that contains thebitmap.Reference: 70-306/70-316 Training kit, To provide a Toolbox bitmap for your control,Skyloong 微软解决方案专家认证 Page 355-356Incorrect Answers070-316 A, C, D: If you specify a Type (type), your control will have the same Toolbox bitmap asthat of the Type (type) you specify.QUESTION 7:You use Visual Studio .NET to develop a Windows-based application that contains asingle form. This form contains a Label control named labelCKValue and a TextBoxcontrol named textCKValue. labelCKValue displays a caption that identifies thepurpose of textCKValue.You want to write code that enables users to place focus in textCKValue when theypress ALT+V. This key combination should be identified to users in the display oflabelCKValue.Which three actions should you take? (Each correct answer presents part of thesolution. Choose three)A. Set labelCKValue.UseMnemonic to True.B. Set labelCKValue.Text to "&Value".C. Set labelCKValue.CausesValidation to True. D. Set textCKValue.CausesValidation to True.E. Set textCKValue.TabIndex to exactly one number less than labelValue.TabIndex.F. Set textCKValue.TabIndex to exactly one number more than labelValue.TabIndex.G. Set textCKValue.Location so that textValue overlaps with labelValue on the screen.H. Add the following code to the Load event of MainForm:text.value.controls.Add (labelValue); Answer: A, B, FExplanation: If the UseMnemonic property is set to true (A) and a mnemoniccharacter (a character preceded by the ampersand) is defined in the Text propertyof the Label (B), pressing ALT+ the mnemonic character sets the focus to thecontrol that follows the Label in the tab order (F). You can use this property toprovide proper keyboard navigation to the controls on your form.Note1 The UseMnemonic property gets or sets a value indicating whether the controlinterprets an ampersand character (&) in the control's Text property to be an access keyprefix character. UseMnemonic is set to True by default.Note 2: As a practice verify the answer yourself.Reference: NET Framework Class Library, Label.UseMnemonic Property [C#]Incorrect AnswersC, 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 labelcontrol.G, H: This is not necessary. It has no effect here.QUESTION 8:Skyloong 微软解决方案专家认证 070-316 You use Visual Studio .NET to create a Windows-based application calledCertkiller Mortage. The main form of the application contains several check boxesthat correspond to application settings. One of the CheckBox controls is namedadvancedCheckBox. 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 thesolution. Choose two)A. Set advancedCheckBox.AutoCheck to True.B. Set advancedCheckBox.AutoCheck to False.C. Set advancedCheckBox.Text to "&Advanced".D. Set advancedCheckBox.Tag to "&Advanced".E. Set advancedCheckBox.CheckState to Unchecked.F. Set advancedCheckBox.CheckState to Indeterminate.G. Set advancedCheckBox.Apperance to Button.H. Set advancedCheckBox.Apperance to Normal.Answer: A, CExplanation: A: The AutoCheck property must be set to True so that the CheckBox automatically ischanged when the check box is accessed.C: The Text property contains the text associated with this control. By using the &-signwe define a shortcut command for this control. "@Advanced" defines the shortcutALT+A.Reference:.NET Framework Class Library, CheckBox Properties.NET Framework Class Library, CheckBox.AutoCheck Property [C#]Incorrect AnswersB: If AutoCheck is set to false, you will need to add code to update the Checked orCheckState values in the Click event handler.D: 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 9: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 atthe bottom of the parent form in every application. It must always be as wide as theform. When the form is resized, the control should be resized and repositionedaccordingly. What should you do? Skyloong 微软解决方案专家认证 070-316 A. 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.B. 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.C. 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: CExplanation: DockStyle.Bottom docks the control to the bottom of the form. This will force the controlto 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 FormsNET Framework Class Library, AnchorStyles Enumeration [C#]Incorrect AnswersA: There is no need to the other developers to set the Dock property.B: 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 10:As a software developer at Certkiller inc. you use Visual Studio .NET to create aWindows-based application. You need to make the application accessible to userswho 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 speakingthe word "name" when a user changes focus to this control. Which property of this control should you configure? A. TagB. NextC. Name D. AccessibleNameE. AccessibleRoleAnswer: DExplanation: The AccessibleName property is the name that will be reported to theaccessibility aids.Reference:Skyloong 微软解决方案专家认证 070-316 Visual Basic and Visual C# Concepts, Providing Accessibility Information for Controlson a Windows Form Visual Basic and Visual C# Concepts, Walkthrough: Creating an Accessible WindowsApplication Incorrect AnswersA, B, C: The Tag, Next and Name properties of a control is not used directly byaccessibility aids.E: The AccessibleRole property describes the use of the element in the user interface. QUESTION 11:You develop a Visual Studio .NET application that dynamically adds controls to itsform 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, andTop properties.When you compile this code, you receive an error message indicating thatButtonHandler is not declared.You need to add a ButtonHandler routine to handle the Click event for alldynamically added Button controls.Which declaration should you use for ButtonHandler? A. public void ButtonHandler()B. public void ButtonHandler(System.Windows.Forms.Buttonsender)C. public void ButtonHandler(System.Object sender)D. public void ButtonHandler(System.Windows.Forms.Buttonsender, System.EventArgs e)E. public void ButtonHandler(System.Object sender,System.EventArgs e)Answer: E QUESTION 12:You develop a Windows-based application that includes the following code segment.(Line numbers are included for reference only.)01 private void Password_Validating(object sender,02 System.ComponentModel.CancelEventArgs e)03 {Skyloong 微软解决方案专家认证 04 if (Valid Certkiller Password() == false)05 {06 //Insert new code.07 }08 }070-316 You must ensure that users cannot move control focus away from textPassword ifValid Certkiller Password returns a value of False. You will add the required code online 6.A. e.Cancel = true; B. sender name; C. password.AcceptsTab = false ; D. password.CausesValidation = false ;Answer: AExplanation: If the input in the control does not fall within required parameters, theCancel property within your event handler can be used to cancel the Validatingevent and return the focus to the control.Reference: 70-306/70-316 Training kit, The Validating and Validated Events, Page 89Incorrect AnswersB: Setting an object to an unknown variable is rubbish.C: The AccptsTab property gets or sets a value indicating whether pressing the TAB keyin a multiline text box control types a TAB character in the control i。