Ensurepass

QUESTION 11

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code segment. (Line numbers are included for reference only.)

clip_image002[7]

You add the following code fragment within a WPF window control.

 

clip_image004[7]

The TextBox control is data-bound to an instance of the Contact class. You need to ensure that the Contact class contains a business rule to ensure that the ContactName property is not empty or NULL. You also need to ensure that the TextBox control validates the input data. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two).

 

A.    Replace line 01 with the following code segment. public class Contact : IDataErrorInfo

B.    Replace line 01 with the following code segment. public class Contact : ValidationRule

C.    Replace line 01 with the following code segment. public class Contact :INotifyPropertyChanging

D.    Add the following code segment at line 04. public event PropertyChangingEventHandler PropertyChanging;

E.    Modify line 07 with the following code segment:

clip_image006[7]

clip_image008[7]

F.    Add the following code segment at line 09.

clip_image010[7]

 

Correct Answer: AF

 

 

QUESTION 12

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code segment.

clip_image012[7]

You add the following code fragment in a WPF window control.

clip_image014[7]

The TextBox control is data-bound to an instance of the Contact class. You plan to implement an ErrorTemplate in the TextBox control. You need to ensure that the validation error message is displayed next to the TextBox control. Which code fragment should you use?

 

A.    clip_image016[7]

B.    clip_image018[7]

C.    clip_image020[7]

D.    clip_image022[7]clip_image024[7]

 

Correct Answer: A

 

 

QUESTION 13

You use Microsoft .NET Framework 4 to create a Windows Forms application.

You have a dataset as shown in the following exhibit. You plan to add a DataGridView to display the dataset. You need to ensure that the DataGridView meets the

following requirements:

Shows Order Details for the selected order.

Shows only Order Details for items that have UnitPrice greater than 20.

Sorts Products by ProductName Which code segment should you use?

A.            ordersBindingSource.DataSource = productsBindingSource;

ordersBindingSource.DataMember = “FK_Order_Details_Products”;

productsBindingSource.Filter = “UnitPrice > 20”;

productsBindingSource.Sort = “ProductName”;

 

B.            productsDataGridView.DataSource = ordersBindingSource;

productsBindingSource.Filter = “UnitPrice > 20”;

productsBindingSource.Sort = “ProductName”;

 

C.            order_DetailsBindingSource.DataSource = ordersBindingSource;

order_DetailsBindingSource.DataMember = “FK_Order_Details_Orders”;

order_DetailsBindingSource.Filter = “UnitPrice > 20”;

productsBindingSource.Sort = “ProductName”;

 

D.            order_DetailsDataGridView.DataSource = ordersBindingSource;

order_DetailsBindingSource.Filter = “UnitPrice > 20”;

productsBindingSource.Sort = “ProductName”;

 

Correct Answer: C

 

 

QUESTION 14

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You plan to use an existing Windows Forms control named MyWinFormControl in the MyControls assembly. You need to ensure that the control can be used in your application. What should you do?

 

A.    Add the following code fragment to the application.

clip_image026[7]

B.    Add the following code fragment to the application.

clip_image028[7]

clip_image030[7]

C.    Add the following code segment to the WindowsLoaded function.

clip_image032[7]

D.    Add the following code segment to the WindowsLoaded function.

clip_image034[7]

Correct Answer: B

 

 

QUESTION 15

You use Microsoft .NET Framework 4 to create a Windows Forms application.

You plan to use a Windows Presentation Foundation (WPF) control of the UserControl1type hosted in an ElementHostcontrol named elementHost1. You write the following code segment. (Line numbers are included for reference only.)

clip_image036[7]

You need to ensure that the application changes the background color of the hosted control when the background color of the form changes. Which code segment should you insert at line 05?

A.            elementHost1.PropertyMap.Remove(“BackColor”);

elementHost1.PropertyMap.Add(“BackColor”, new PropertyTranslator

(OnBackColorChange));

 

B.            elementHost1.PropertyMap.Remove(“Background”);

elementHost1.PropertyMap.Add(“Background”, new PropertyTranslator

(OnBackColorChange));

 

C.            elementHost1.PropertyMap.Add(“BackColor”, new PropertyTranslator(OnBackColorChange));

elementHost1.PropertyMap.Apply(“BackColor”);

 

D.            elementHost1.PropertyMap.Add(“Background”, new PropertyTranslator(OnBackColorChange));

elementHost1.PropertyMap.Apply(“Background”);

 

Correct Answer: A

 

 

QUESTION 16

You use Microsoft .NET Framework 4 to create a Windows Forms application.

You need to allow the user interface to use the currently configured culture settings in the Control Panel. Which code segment should you use?

 

A.            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

B.            Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture;

C.            Thread.CurrentThread.CurrentUICulture = CultureInfo.InstalledUICulture;

D.            Thread.CurrentThread.CurrentCulture = CultureInfo.InstalledUICulture;

 

Correct Answer: A

 

 

QUESTION 17

You use Microsoft .NET Framework 4 to create a Windows Forms application. You created a new application, you then wrote the code below:

Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

Which of the following options are TRUE?

 

A.            The user interface will make use of the currently configured culture settings in the Control Panel at present.

B.            The user interface will make use of new culture settings.

C.            The user interface will have no culture settings.

D.            The user interface will make use of the culture settings that were installed with the operating system.

 

Correct Answer: A

 

 

QUESTION 18

You use Microsoft .NET Framework 4 to create an application.

The application contains a partially trusted client assembly and a server assembly. You create a custom sandboxed application domain. You need to ensure that

the application can be executed in a partial-trust environment. What should you do?

 

A.            Apply the following attribute to the server assembly.

[assembly: AllowPartiallyTrustedCallers

(PartialTrustVisibilityLevel=VisibleToAllHosts)]

 

B.            Apply the following attribute to the server assembly.

[assembly: AllowPartiallyTrustedCallers

(PartialTrustVisibilityLevel=NotVisibleByDefault)]

 

C.            Apply the following attribute to the client assembly.

[assembly: AllowPartiallyTrustedCallers

(PartialTrustVisibilityLevel=VisibleToAllHosts)]

 

D.            Apply the following attribute to the client assembly.

[assembly: AllowPartiallyTrustedCallers

(PartialTrustVisibilityLevel=NotVisibleByDefault)]

 

Correct Answer: B

 

 

QUESTION 19

You upgrade a Windows Forms application to Microsoft .NET Framework 4. The application was developed by using a previous version of the .NET Framework.

The application uses the Code Access Security (CAS) policy for file access. When the application is executed, you receive the following exception:

“NotSupportedException: This method uses CAS policy, which has been obsoleted by the .NET Framework.”

You need to resolve the error. What should you do?

 

A.    Add the following code fragment to the application’s configuration file.

clip_image038[7]

B.    Add the following code fragment to the application’s configuration file.

clip_image040[7]

C.    Add the following code segment to the application’s main method.

clip_image042[7]

D. Add the following code segment to the application’s main method.

clip_image044[7]

 

 

QUESTION 20

You use Microsoft .NET Framework 4 to create a Windows Forms client application. You write the following code segment.

clip_image046[7]

The application contains a form of type Form1 that contains a FormSettingsobject named frmSettings1. You need to maintain the user’s form size preference each time the user executes the application. Which code segment should you use?

 

A.    clip_image048[7]

B.    clip_image050[7]

clip_image052[7]

C.    clip_image054[7]

D.    clip_image056[7]

 

Correct Answer: D

 

Download Latest MCTS 70-511 Real Free Tests , help you to pass exam 100%.

Comments are closed.