1.
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You create a WPF window in the application. You add the following code segment to the application. Public Class ViewModel Public Property Data() As CollectionView Get End Get Set End Set End Property End Class Public Class BusinessObject Public Property Name() As String Get End Get Set End Set End Property End Class The DataContext property of the window is set to an instance of the ViewModel class. The Data property of the ViewModel instance is initialized with a collection of BusinessObject objects. You add a TextBox control to the window. You need to bind the Text property of the TextBox control to the Name property of the current item of the CollectionView of the DataContext object. You also need to ensure that when a binding error occurs, the Text property of the TextBox control is set to N/A . Which binding expression should you use?
2.
You use Microsoft .NET Framework 4 to create a Windows Forms application. You add a new class named Customer to the application. You select the Customer class to create a new object data source. You add the following components to a Windows Form:
3.
You are analyzing a Windows client application that uses Microsoft Visual Studio 2010 and Microsoft SQL Server 2008. The application updates two database tables from the main user interface (UI) thread. You need to ensure that the following requirements are met: The database tables are either updated simultaneously or not updated at all. Users are notified of the success or failure of the updates. Users are able to perform other tasks during the update process. What should you do?
4.
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. The application has two DataTable objects that reference the Customers and Orders tables in the database. The application contains the following code segment. (Line numbers are included for reference only.)
01 Dim customerOrders As New DataSet()
02 customerOrders.EnforceConstraints = True
03 Dim ordersFK As New ForeignKeyConstraint("ordersFK",
04 customerOrders.Tables("Customers").Columns("CustomerID"),
05 customerOrders.Tables("Orders").Columns("CustomerID"))
06
07 customerOrders.Tables("Orders").Constraints.Add(ordersFK)
You need to ensure that an exception is thrown when you attempt to delete Customer records that have related Order records. Which code segment should you insert at line 06?
5.
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 partialtrust environment. What should you do?
6.
You use Microsoft .NET Framework 4 to create a Windows Forms client application. You write the following code segment. NotInheritable Class FormSettings Inherits ApplicationSettingsBase _ _ Public Property FormSize() As Size Get Return DirectCast(Me ("FormSize"), Size) End Get Set Me("FormSize") = value End Set End Property End Class The application contains a form of type Form1 that contains a FormSettings object 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?
7.
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. The application uses the following object query to load a product from the database. (Line numbers are included for reference only.) 01 Using advWorksContext As New AdventureWorksEntities() 02 Dim productQuery As ObjectQuery(Of Product) = 03 advWorksContext.Product.Where("it.ProductID = 900") 04 05 End Using You need to log the command that the query executes against the data source. Which code segment should you insert at line 04?

 
8.
You are designing a Windows Presentation Foundation (WPF) application by using Microsoft .NET Framework 4 and Microsoft Visual Studio 2010. The application will consist of a user interface (UI) tier and a middle tier. The middle tier will be implemented by using Windows Communication Foundation (WCF). You plan to design the exception handling strategy for the application. Each method in the middle tier will contain the following catch block. Catch e As ArgumentNullException Throw e When testing the application, you discover that all ArgumentNullExceptions that occur in the middle tier do not contain accurate stack trace information. What should you do?
9.
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You write the following code segment that executes two commands against the database within a transaction. (Line numbers are included for reference only.)
01 Using connection As New SqlConnection(cnnStr)
02 connection.Open()
03 Dim sqlTran As SqlTransaction = connection.BeginTransaction()
04 Dim command As SqlCommand = connection.CreateCommand()
05 command.Transaction = sqlTran
06 Try
07 command.CommandText = "INSERT INTO Production.ScrapReason(Name) VALUES('Wrong size')"
08 command.ExecuteNonQuery()
09 command.CommandText = "INSERT INTO Production.ScrapReason(Name) VALUES('Wrong color')"
10 command.ExecuteNonQuery()
11
12 End Using
You need to log error information if the transaction fails to commit or roll back. Which code segment should you insert at line 11?
10.
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You need to ensure that users can view content in a bookreading format that displays two pages at a time. Which control should you use?