PrepAway - Latest Free Exam Questions & Answers

Category: 70-523

Exam 70-523: Upgrade: Transition your MCPD .NET Framework 3.5 Web Developer Skills to MCPD .NET Framework 4 Web Developer

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

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?

Which code segment should you insert at line 03?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You are creating the data layer of the application. You write the following code segment. (Line numbers are included for reference only.)
01 public static SqlDataReader GetDataReader(string sql){
02 SqlDataReader dr;
03
04 return dr;
05 }
You need to ensure that the following requirements are met:
The SqlDataReader returned by the GetDataReader method can be used to retrieve rows from the database.
SQL connections opened within the GetDataReader method will close when the SqlDataReader is closed.
Which code segment should you insert at line 03?

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application uses the ADO.NET Entity Framework to model entities. The application allows users to make changes to entities while disconnected from the central data store.
You need to ensure that when the user connects to the central data store and retrieves new data, the application meets the following requirements:
Changes made to the local data store in disconnected mode are preserved.
Entities that have already been loaded into the local data store, but have not been modified by the user, are updated with the latest data.
What should you do?

What should you do?

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. The database includes a table that contains information about all the employees. The database table has a field named EmployeeType that identifies whether an employee is a Contractor or a Permanent employee. You declare the Employee entity base type. You create a new Association entity named Contractor that inherits the Employee base type. You need to ensure that all Contractors are bound to the Contractor class. What should you do?

Which header and request type should you use in the application?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Communication Foundation (WCF) Data Services service. You discover that when an application submits a PUT or DELETE request to the Data Services service, it receives an error. You need to ensure that the application can access the service. Which header and request type should you use in the application?

Which code segment should you insert at line 07?

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. The database includes a table named dbo.Documents that contains a column with large binary dat a. You are creating the Data Access Layer (DAL). You add the following code segment to query the dbo.Documents table. (Line numbers are included for reference only.)

01public void LoadDocuments(DbConnection cnx)
02{
03var cmd = cnx.CreateCommand();
04cmd.CommandText = “SELECT * FROM dbo.Documents”;
05…
06cnx.Open();
07
08ReadDocument(reader); }

You need to ensure that data can be read as a stream. Which code segment should you insert at line 07?

Which code segment should you insert at line 10?

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.
The database includes a database table named ProductCatalog as shown in the exhibit. (Click the Exhibit button.)
You add the following code segment to query the first row of the ProductCatalog table. (Line numbers are included for reference only.)
01 using (var cnx = new SqlConnection(connString))
02 {
03 var command = cnx.CreateCommand();
04 command.CommandType = CommandType.Text;
05 command.CommandText =”SELECT TOP 1 * FROM dbo.ProductCatalog”;
06 cnx.Open();
07 var reader = command.ExecuteReader();
08 if (reader.Read()) {
09 var id = reader.GetInt32(0);
10
11 reader.Close();
12 }
13 }
You need to read the values for the Weight, Price, and Status columns.
Which code segment should you insert at line 10?

Exhibit:


Page 14 of 14« First...1011121314