PrepAway - Latest Free Exam Questions & Answers

Category: 70-516 (v.2)

Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4 (update October 26th, 2015)

You need to ensure that the Productlmage field is retrieved from the database only when it is needed by the ap

You use Microsoft .NET Framework 4 to develop an application that uses LINQ to SQL. The Product
entity in the LINQ to SQL model contains a field named Productlmage. The Productlmage field holds
a large amount of binary data. You need to ensure that the Productlmage field is retrieved from the
database only when it is needed by the application. What should you do?

Which line of code should you insert at line 21?

You use Microsoft .NET Framework 4 to develop an application that connects to two separate
Microsoft SQL Server 2008 databases. The Customers database stores all the customer information,
and the Orders database stores all the order information. The application includes the following
code. (Line numbers are included for reference only.)
01 try
02 {
03 conn.Open();
04 tran = conn.BeginTransaction(“Order”);
05 SqlCommand cmd = new SqlCommand();
06 cmd.Connection = conn;
07 cmd.Transaction = tran;
08 tran.Save(“save1”);
09 cmd.CommandText – “INSERT INTO [Cust].dbo.Customer ” +
“(Name, PhoneNumber) VALUES (‘Paul Jones’, “ + “‘404-555-1212’)”;
10 cmd.ExecuteNonQuery(); iltran.Save(“save2”);
12 cmd.CommandText = “INSERT INTO [Orders].dbo.Order ” +
“(CustomerID) VALUES (1234)”;
13 cmd.ExecuteNonQuery();
14 tran.Save(“save3”);
15 cmd.CommandText = “INSERT INTO [Orders] .dbo.” +
“OrderDetail (OrderlD, ProductNumber) VALUES” + “(5678, ‘DC-6721’)”;
16 cmd.ExecuteNonQuery();
17 tran.Commit();
18 }
19 catch (Exception exj
20 {
21
22 }
You run the program, and a timeout expired error occurs at line 16. You need to ensure that the
customer information is saved in the database. If an error occurs while the order is being saved, you
must roll back all of the order information and save the customer information. Which line of code
should you insert at line 21?

You need to ensure that all generated entities inherit from MyBaseClass

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application.
You use the Entity Framework Designer to create the following Entity Data Model.

The application contains a class as shown in the following code segment.
public class MyBaseClass : EntityObject
{
….
}
You need to ensure that all generated entities inherit from MyBaseClass.
What should you do?

Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses the Entity Framework. The application defines the following Entity Data Model.

Within the .edmx file, the following function is defined,
<Funccion Naroe=”Round” ReturnType=”Decimal”>
<Parameter Name=”val” Type=”Decimal” />
<DefiningExpression>
CAST(val as Edm.Int32)
</DefiningExpcession>
</Function>
The application includes the following LINQ query.
var query = from detail in context.SalesOrderDetails
select detail.LineTotal.Round() ;
You need to ensure that the Round function executes on the database server when the query is
executed.
Which code segment should you use?

Which code segment should you insert at line 08?

You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 2008 database. You add the following table to the database.
CREATE TABLE Orders(
ID numeric(18, 0) NOT NULL,
OrderName varchar(50) NULL,
OrderTime time(7) NULL,
OrderDate date NULL)
You write the following code to retrieve data from the OrderTime column. (Line numbers are
included for reference only.)
01 SqlConnection conn = new SqlConnection (…) ;
02 conn.Open();
03 SqlCommand cmd = new SqlCommand(
“SELECT ID, OrderTime FROM Orders”, conn);
04 SqlDataReader rdr = cmd.ExecuteReader(); 05
06 while(rdr.Read())
07 {08
09 }
You need to retrieve the OrderTime data from the database.
Which code segment should you insert at line 08?

Which code segment should you insert at line 03?

You use Microsoft .NET Framework 4 to develop an application. You write the following code to
update data in a Microsoft SQL Server 2008 database. (Line numbers are included for reference
only.)

01 private void ExecuteUpdate (SqlCoiranand cmd,
string connString, string updateStrnt)
02 {
03
04 }
You need to ensure that the update statement executes and that the application avoids connection
leaks.
Which code segment should you insert at line 03?


Page 9 of 31« First...7891011...2030...Last »