What should you do

A. Create a control array consisting of four Button controls.

Your code will inspect the Index argument that is passed into the Click event.

B. Create a control array consisting of four Button controls.

Your code will inspect the Index property of the sender parameter of the Click event.

C. Create four individual Button controls.

Create a procedure named NavButtons_Click to handle the Click event for all four controls by using the AddHandler keyword.

D. Create four individual Button controls.

Create a procedure named NavButtons_Click to handle the Click event for all four controls by using the Implements keyword.

Answer: C

Explanation: The AddHandler statement is similar to the Handles clause in that both allow you to specify an event handler that will handle an event. We can use the AddHandler statement to add the four events to the event handler, the NavButtons_clock procedure.

Reference:

Visual Basic Language Concepts, AddHandler and RemoveHandler Visual Basic Concepts, Control Array Changes in Visual Basic .NET Visual Basic Language Concepts, Implements Keyword

Incorrect Answers

A, B: Control arrays could be used in Visual Basic 6.0, but they are no longer supported in Visual Basic .NET. D: The Implements keyword is used to signify that a class member implements a specific interface. We should not implement an interface in this scenario however. We want to configure events for an event handler.

QUESTION NO: 59

You use Visual Studio .NET to create a Windows-based application. On the main application form, TestKingFormMain, 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 F1 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?

A. textConnectionString_KeyPress

B. textConnectionString_KeyDown

C. textConnectionString_KeyUp

D. textConnectionString_GiveFeedback

E. 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 F1 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:

1. KeyDown

2. KeyPress

3. KeyUp

Reference:

.NET Framework Class Library, Control.HelpRequested Event [Visual Basic] .NET Framework Class Library, Control.KeyDown Event [Visual Basic]

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 NO: 60

Your company uses Visual Studio .NET to create a Windows-based application for TestKing. 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)

A. Create a strong name for Schedule.

B. Use side-by-se execution to run Schedule.

C. Install Schedule in the global assembly cache.

D. Move Schedule to the Windows\System32 folder.

E. Create a reference in EmployeeTracker to Schedule.

F. Create a reference in EmployeeTracker to CustomerTracker.

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\System32 folder. F: The application should reference the assembly, not the first application.

QUESTION NO: 61

You use Visual Studio .NET to create a Windows-based application. The application includes a form named ConfigurationForm.

ConfigurationForm contains 15 controls that enable users to set basic configuration options for the application. You design these controls to dynamically adjust when users resize ConfigurationForm. The controls automatically update their size and position on the form as the form is resized. The initial size of the form should be 650 x 700 pixels.

If ConfigurationForm is resized to be smaller then 500 x 600 pixels, the controls will not be displayed correctly. You must ensure that users cannot resize ConfigurationForm to be smaller than 500 x 600 pixels.

Which two actions should you take to configure ConfigurationForm? (Each correct answer 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 MaximizeBox property to True.

G. Set the Size property to "500,600".

H. Set the Size property to "650,700".

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 "500, 600".

H: We use the size property to set the initial size of the form. The initial size should be set to "650, 700". Reference:

.NET Framework Class Library, Form.MinimumSize Property [Visual Basic] .NET Framework Class Library, Form.Size Property [Visual Basic]

0 0

Post a comment