Microsoft TS: Windows Applications Development with Microsoft .NET Framework 4 (070-511) Free Practice Test
Question 1
You use Microsoft .NET Framework 4 to create a Windows Forms application.
You plan to use a Windows Presentation Foundation (WPF) control of the UserControl1 type hosted in an ElementHos1 control named elementHost1.
You write the following code segment. (Line numbers are included for reference only.)
01 Public Class UPFInUInforms
02 Public Sub WPFInWInforms()
03 InitializeComponent() 04
05 End Sub
06 Private Sub OnBackColorChange(ByVal sender As Object, ByVal propertyName As [String], ByVal value As Object)
07 Dim host As ElementHost = TryCast(sender, ElementHost)
08 Dim col As System.Drawing.Color = DirectCast(value, System.Drawing.Color)
09 Dim brush As New SolidColorBrush(System.Windows.Media.Color.FromRgb(col,R, col.G, col.B))
10 Dim ucl As UserControll = TryCast(host.Child, UserControll)
11 ucl.Background = brush
12 End Sub
13 End Class
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 04?
You plan to use a Windows Presentation Foundation (WPF) control of the UserControl1 type hosted in an ElementHos1 control named elementHost1.
You write the following code segment. (Line numbers are included for reference only.)
01 Public Class UPFInUInforms
02 Public Sub WPFInWInforms()
03 InitializeComponent() 04
05 End Sub
06 Private Sub OnBackColorChange(ByVal sender As Object, ByVal propertyName As [String], ByVal value As Object)
07 Dim host As ElementHost = TryCast(sender, ElementHost)
08 Dim col As System.Drawing.Color = DirectCast(value, System.Drawing.Color)
09 Dim brush As New SolidColorBrush(System.Windows.Media.Color.FromRgb(col,R, col.G, col.B))
10 Dim ucl As UserControll = TryCast(host.Child, UserControll)
11 ucl.Background = brush
12 End Sub
13 End Class
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 04?
Correct Answer: C
Question 2
You are developing a Windows Presentation Foundation (WPF) application that displays financial data.
The following style is applied to every Label control that displays currency. (Line numbers are included for reference only.)

You need to ensure that the style is updated to meet the following requirements regarding currency:
Which markup segment should you insert at line 06?

The following style is applied to every Label control that displays currency. (Line numbers are included for reference only.)

You need to ensure that the style is updated to meet the following requirements regarding currency:
Which markup segment should you insert at line 06?

Correct Answer: A
Question 3
You are developing a Windows Presentation Foundation (WPF) application. The application contains a converter named DateOutputConverter that formats dates.
The window is defined as follows. (Line numbers are included for reference only.)

The window must display the OrderDate value found in shippedOrder. The text box must display the OrderDate formatted by the DateOutputConverter.
You need to ensure that the OrderDate is displayed and formatted correctly.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
The window is defined as follows. (Line numbers are included for reference only.)

The window must display the OrderDate value found in shippedOrder. The text box must display the OrderDate formatted by the DateOutputConverter.
You need to ensure that the OrderDate is displayed and formatted correctly.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
Correct Answer: A,D
Question 4
You use Microsoft .NET Framework 4 to create a Windows Presentation Framework (WPF) application.
You plan to create a custom control that contains four text input fields. Each of the text input fields within the control will contain a label.
You need to ensure that the text input fields within the control can be validated by using a regular expression Validator.
Which class should you inherit from?
You plan to create a custom control that contains four text input fields. Each of the text input fields within the control will contain a label.
You need to ensure that the text input fields within the control can be validated by using a regular expression Validator.
Which class should you inherit from?
Correct Answer: D
Question 5
HOTSPOT
You use Microsoft .NET Framework 4 to create a Windows Presentation Framework (WPF)
application.
The application contains a DockPanel named DockPanel1. DockPanel1 contains a ListBox
named List1 and a Button named Button 1.
End-users discover that when they run the application, their mouse pointer disappears
when they hover over List1.
You run the application in debug mode and open the WPF Tree Visualizer.
You need to identify which property causes the issue.
Which property should you identify? (To answer, select the appropriate property in the
answer area.)

You use Microsoft .NET Framework 4 to create a Windows Presentation Framework (WPF)
application.
The application contains a DockPanel named DockPanel1. DockPanel1 contains a ListBox
named List1 and a Button named Button 1.
End-users discover that when they run the application, their mouse pointer disappears
when they hover over List1.
You run the application in debug mode and open the WPF Tree Visualizer.
You need to identify which property causes the issue.
Which property should you identify? (To answer, select the appropriate property in the
answer area.)

Correct Answer:

Question 6
DRAG DROP
You are developing a Windows Presentation Foundation (WPF) application.
You are creating a screen named NewsList that contains a ListView control. NewsList must meet the following requirements:
NewsList must display data from an object named News.
Each item displayed in NewsList must use a data template named dataTemplatel.
NewsList must be displayed by using a grid that has a maximum of four rows.
---
You need to identify which property to use for each requirement.
What should you identify? (To answer, drag the appropriate properties to the correct requirements. Each property may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

You are developing a Windows Presentation Foundation (WPF) application.
You are creating a screen named NewsList that contains a ListView control. NewsList must meet the following requirements:
NewsList must display data from an object named News.
Each item displayed in NewsList must use a data template named dataTemplatel.
NewsList must be displayed by using a grid that has a maximum of four rows.
---
You need to identify which property to use for each requirement.
What should you identify? (To answer, drag the appropriate properties to the correct requirements. Each property may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

Correct Answer:

Question 7
You develop a Windows Presentation Foundation (WPF) application. The application runs
on 64-bit machines only.
The application architects want to store application settings in the registry. The users do not have write access to these settings. These application settings apply to everyone using the application.
You need to read the application settings successfully from the registry.
Which code segment should you use?
on 64-bit machines only.
The application architects want to store application settings in the registry. The users do not have write access to these settings. These application settings apply to everyone using the application.
You need to read the application settings successfully from the registry.
Which code segment should you use?
Correct Answer: A
Question 8
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains a custom control that is used to display customer Information.
You discover that the custom control is not rendering correctly.
You need to identify the WPF element that is causing the issue.
What should you do?
You discover that the custom control is not rendering correctly.
You need to identify the WPF element that is causing the issue.
What should you do?
Correct Answer: A
Question 9
You are developing a Windows Presentation Foundation (WPF) application.
An element binding consistently throws errors because the data retrieval is slow.
You need to ensure that the PresentationTraceSource binding is configured to debug the source of these errors.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two).
An element binding consistently throws errors because the data retrieval is slow.
You need to ensure that the PresentationTraceSource binding is configured to debug the source of these errors.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two).
Correct Answer: C,D
Question 10
You are developing a Windows Presentation Foundation (WPF) application. The application contains the following markup.

You need to ensure that the Filter combo box is hidden when the expander is collapsed.
What should you do?

You need to ensure that the Filter combo box is hidden when the expander is collapsed.
What should you do?
Correct Answer: B
Question 11
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application uses the drag-and-drop functionality.
You need to ensure that the drag-and-drop operation is stopped when a user moves the cursor outside the boundaries of the application form
Which enumeration member should you use?
You need to ensure that the drag-and-drop operation is stopped when a user moves the cursor outside the boundaries of the application form
Which enumeration member should you use?
Correct Answer: A
Question 12
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.)

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

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).

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

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).
Correct Answer: A,E
Question 13
You develop a Windows Presentation Foundation (WPF) application. This application is used to output data trends to customer service representatives.
You use threading to keep the UI responsive. You have a function named UpdateUI that updates all of the UI components.
You use the following code to update the _Data variable. (Line numbers included for reference only.)

You need to update the user interface without knowing if you are on the UI thread.
Which code segment should you insert at line 06?
You use threading to keep the UI responsive. You have a function named UpdateUI that updates all of the UI components.
You use the following code to update the _Data variable. (Line numbers included for reference only.)

You need to update the user interface without knowing if you are on the UI thread.
Which code segment should you insert at line 06?
Correct Answer: A
Question 14
You use Microsoft .NET Framework 4 to create a Windows Forms application.
You write the following code segment. (Line numbers are included for reference only.)
01 NotInheritable Class FormSettings
02 Inherits ApplicationSettingsBase 03
04 Public Property Description() As [String]
05 Get
06 Return DirectCast(He("Description"), [String])
07 End Get
08 Set
09 Me("Description") -value
10 End Set
11 End Property
12 End Class
You need to ensure that the first time each user opens the application, a text field displays the following message: "Please enter your setting."
Which code segment should you insert at line 03?
You write the following code segment. (Line numbers are included for reference only.)
01 NotInheritable Class FormSettings
02 Inherits ApplicationSettingsBase 03
04 Public Property Description() As [String]
05 Get
06 Return DirectCast(He("Description"), [String])
07 End Get
08 Set
09 Me("Description") -value
10 End Set
11 End Property
12 End Class
You need to ensure that the first time each user opens the application, a text field displays the following message: "Please enter your setting."
Which code segment should you insert at line 03?
Correct Answer: C