PrepAway - Latest Free Exam Questions & Answers

Tag: 70-516

Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4

Which code segment should you inser at line 03?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application contains following XML document.

<feed>
<title>Products</title>
<entry>
<title>Entry title 1</title>
<author>Author 1</author>
<content>
<properties>
<description>some description</description>
<notes>some notes</notes>
<comments>some comments</comments>
</properties>
</content>
</entry>

</feed>

You plan to add localization features to the application. You add the following code segment.
(Line numbers are included for reference only.)

01 public IEnumerable <XNode> GetTextNodesForLocalization(XDocument doc)
02 {
03 …
04 return from n in nodes
05 where n.NodeType = XmlNodeType.Text
06 select n;
07 }

You need to ensure that the GetTextNodeForLocalization method returns all the XML text nodes of the XML document.
Which code segment should you inser at line 03?

Which line of code should you insert at line 09?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application
that connects to a Microsoft SQL Server 2008 database. You add the following table to the database.

CREATE TABLE ObjectCache (
Id INT IDENTITY PRIMARY KEY,
SerializedObjectData XML)

You write the following code segment to retreive records from the ObjectCache table.
(Line numbers are included for reference only.)

01 string s = GetConnectionStringFromConfigFile(“xmldb”);
02 using (SqlConnection conn = new SqlConnection(s))
03 using (SqlCommand cmd = new SqlCommand(“select * from ObjectCache”, conn))
04 {
05 conn.Open();
06 SqlDataReader rdr = cmd.ExecuteReader();
07 while(rdr.Read())
08 {
09 …
10 DeserializeObject(obj);
11 }
12 }

You need to retreive the data from the SerializedObjectData column and pass it to a method named DeserializeObject.
Which line of code should you insert at line 09?

Which code segment should you insert at line 04?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database. You add the following store procedure to the database.

CREATE PROCEDURE GetSalesPeople
AS
BEGIN
SELECT FirstName, LastName, Suffix, Email, Phone
FROM SalesPeople
END

You write the following code segment. (Line numbers are included for reference only.)

01 SqlConnection connection = new SqlConnection(“…”);
02 SqlCommand command = new SqlCommand(“GetSalesPeople”, connection);
03 command.CommandType = CommandType.StoredProcedure;
04 …

You need to retreive all of the results from the stored procedure. Which code segment should you insert at line 04?

Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework.
The application has an entity model that includes SalesTerritory and SalesPerson entities as shown in the following diagram.

You need to calculate the total bonus for all sales people in each sales territory. Which code segment should you use?

Which code segment should you insert at the line 04?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 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 {
03 SqlDataReader dr = null;
04 …
05 return dr;
06 }

You need to ensure that the following requirements are met:
* The SqlDataReader returned by the GetDataReader method can be used to retreive 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 the line 04?

Which code segment should you insert in line 03?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database. The application uses the ADO.NET Entity Framework to model entities.
The database includes objects based on the exhibit (click the Exhibit button).

The application includes the following code segment. (Line numbers are included for reference only.)

01 using(AdventureWorksEntities context = new AdventureWorksEntities())
02 {
03 …
04 foreach (SalesOrderHeader order in customer.SalesOrderHeader)
05 {
06 Console.WriteLine(String.Format(“Order: {0} “, order.SalesOrderNumber));
07 foreach (SalesOrderDetail item in order.SalesOrderDetail)
08 {
09 Console.WriteLine(String.Format(“Quantity: {0} “, item.Quantity));
10 Console.WriteLine(String.Format(“Product: {0} “, item.Product.Name));
11 }
12 }
13 }

You want to list all the orders for a specific customer. You need to ensure that the list contains following fields:
* Order number
* Quantity of products
* Product name

Which code segment should you insert in line 03?

Which line of code should you use?

You develop a Microsoft .NET application that uses Entity Framework to store entities in a Microsft SQL Server 2008 database.
While the application is disconnected from the database, entities that are modified, are serialized to a local file.

The next time the application connects to the database, it retrieves the identity from the database by using an object context
named context and stores the entity in a variable named remoteCustomer.
The application then serializes the Customer entity from the local file and stores the entity in a variable named localCustomer.
The remoteCustomer and the localCustomer variables have the same entity key.

You need to ensure that the offline changes to the Customer entity is persisted in the database when the ObjectContext.SaveChanges() method is called.
Which line of code should you use?

Which code segment should you use?

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

You add the following code fragment:

using(var context = new AdventureWorksLTEntities())
{
Customer cust = context.Customers.First();
cust.CompanyName = “Contoso”;
int count = 0;
}

The changes to the cust entity must be saved. If an exception is thrown, the application will attempt to save up to 3 times.
If not, an exception is thrown. Which code segment should you use?


Page 8 of 19« First...678910...Last »