Which line of code should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The configuration file contains the following code segment.
<configuration>
<connectionStrings>
<add name=”AdventureWorksLT”
connectionString=”DataSource=SQL01;InitialCatalog=AdventureWorksLT;IntegratedSecurity=True;”
providerName=”System.Data.SqlClient”/>
</connectionStrings>
</configuration>
You need to retrieve the connection string named AdventureWorksLT from the configuration file. Which line of code should you use?
Which two actions should you perform?
You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx.
TestPage.aspx uses TestUserControl.ascx as shown in the following line of code.
<uc:TestUserControl ID=”testControl” runat=”server”/>
On TestUserControl.ascx, you need to add a read-only member named CityName to return the value “New York”.
You also must add code to TestPage.aspx to read this value.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
Which code segment should you insert at line 11?
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.)
01using (SqlConnection connection = new SqlConnection(cnnStr)) {
02connection.Open();
03SqlTransaction sqlTran = connection.BeginTransaction();
04SqlCommand command = connection.CreateCommand();
05command.Transaction = sqlTran;
06try {
07command.CommandText = “INSERT INTO Production.ScrapReason(Name) VALUES(‘Wrong size’)”;
08command.ExecuteNonQuery();
09command.CommandText = “INSERT INTO Production.ScrapReason(Name) VALUES(‘Wrong color’)”;
10command.ExecuteNonQuery();
11
12}
You need to log error information if the transaction fails to commit or roll back.
Which code segment should you insert at line 11?
What should you do?
You are creating a Windows Communication Foundation (WCF) service to process orders. The data contract for the order is defined as follows. <DataContract()>
Public Class Order …
<DataMember()>
Public Property CardHolderName As String
<DataMember()>
Public Property CreditCardNumber As String
End Class
You have the following requirements:
Enable the transmission of the contents of Order from the clients to the service. Ensure that the contents of CreditCardNumber are not sent across the network in clear text. Ensure that the contents of CreditCardNumber are accessible by the service to process the order. You need to implement the service to meet these requirements. What should you do?
What should you do?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You create an Entity Data Model (EDM) by using the Microsoft ADO.NET Entity Data Model Designer (Entity Designer).
The EDM contains a complex type. You need to map a stored procedure to the complex type by using the Entity Designer.
What should you do?
Which code segment should you use?
You create a Web page named TestPage.aspx and a user control named contained in a file named TestUserControl.ascx.
You need to dynamically add TestUserControl.ascx to TestPage.aspx.
Which code segment should you use?
Which code segment should you insert at line 06?
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.
01DataSet customerOrders = new DataSet();
02customerOrders.EnforceConstraints = true;
03ForeignKeyConstraint ordersFK = new ForeignKeyConstraint(“ordersFK”,
04customerOrders.Tables[“Customers”].Columns[“CustomerID”],
05customerOrders.Tables[“Orders”].Columns[“CustomerID”]);
06
07customerOrders.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?
What are two possible ways to achieve this goal?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database. You create classes by using LINQ to SQL based on the records shown in the exhibit. (Click the Exhibit button.) You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID properties. You need to retrieve the total price amount of each Order record. What are two possible ways to achieve this goal (Each correct answer presents a complete solution. Choose two.)
<transport clientCredentialType="Basic" ?
You are developing an application to update a user’s social status. You need to consume the service using Windows Communication Foundation (WCF). The client configuration is as follows.
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name=”SocialConfig”>
<security mode=”TransportCredentialOnly”>
<transport clientCredentialType=”Basic” ?realm=”Social API” />
</security>
</binding>
</webHttpBinding>
</bindings>
<client>
<endpoint address=”http://contoso.com” binding=”webHttpBinding” bindingConfiguration=”SocialConfig” contract=”ISocialStatus” name=”SocialClient” />
</client>
</system.serviceModel>
The service contract is defined as follows.
<ServiceContract()>
Public Interface ISocialStatus <OperationContract()> <WebInvoke(UriTemplate:=”/statuses/update.xml?status={text}”)> Sub UpdateStatus(ByVal text As String) End Interface
Which code segment should you use to update the social status?
Which code segment should you use?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL.
You create a data model name AdvWorksDataContext, and you add the Product table to the data model.
The Product table contains a decimal column named ListPrice and a string column named Color.
You need to update ListPrice column where the product color is Black or Red. Which code segment should you use?