New Updated Microsoft MCTS 70-516 Real Exam Questions and Answers Download 101-110

Ensurepass

QUESTION 101

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You need to create a Plain Old CLR Object (POCO) class that can be used with the ObjectContext.CreateObject method to create a proxy. What should you do?

 

  1. Create a custom data class that has a Protected constructor that does not have parameters.

  2. Create a custom data class in which all properties and methods are virtual.

  3. Create a custom data class that is abstract.

  4. Create a custom data class that is sealed.

 

Correct Answer: A

 

 

QUESTION 102

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an ASP.NET Web application that uses the Entity Framework. The build configuration is set to Release. The application must be published by using Microsoft Visual Studio 2010, with the following requirements:

 

  • The database schema must be created on the destination database server.

  • The Entity Framework connection string must be updated so that it refers to the destination database server.

 

You need to configure the application to meet the requirements. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

 

  1. Generate the DDL from the Entity Framework Designer and include it in the project. Set the action for the DDL to ApplicationDefinition.

  2. Set Items to deploy in the Package/Publish Web tab to All files in this Project Folder for the release configuration.

  3. Use the web.config transform file to modify the connection string for the release configuration.

  4. Include the source database entry in the Package/Publish SQL tab and update the connection string for the destination database.

 

Correct Answer: CD

 

 

QUESTION 103

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You need to retrieve an entity, and you must ensure that the entity is loaded in a detached state. Which MergeOption enumeration value should you use to retrieve the entity?

 

  1. PreserveChanges

  2. OverwriteChanges

  3. AppendOnly

  4. NoTracking

 

Correct Answer: D

 

 

QUESTION 104

How do you define a WCF Data Service query to grab the first 10 records. Options are something like:

 

  1. DataServiceQuery<Order> selectedOrders = context.Orders.AddQueryOption(“$top”, “10”);

  2. DataServiceQuery<Order> selectedOrders = context.Orders.AddQueryOption(“$filter”, “10”);

  3. DataServiceQuery<Order> selectedOrders = context.Orders.AddQueryOption(“$select”, “10”);

  4. DataServiceQuery<Order> selectedOrders = context.Orders.AddQueryOption(“$expand”, “10”);

 

Correct Answer: A

 

 

QUESTION 105

There are Entities – States Class, Cities class. Deleting of state id raises exception. Which of the following?

 

  1. EntityException

  2. ConstraintException

  3. UpdateException

  4. EntityUpdateException

 

Correct Answer: B

 

 

QUESTION 106

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. You use Entity SQL to retrieve data from the database. You need to find out whether a collection is empty. Which entity set operator should you use?

 

A. ANYELEMENT

B. EXCEPT

C. EXISTS

D. IN

 

Correct Answer: C

 

 

QUESTION 107

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. A file named books.xml contains the following XML.

 

<bib>

<book title=”Programming in Unix” year=”1992″>

<author>Author1</author>

<author>Author2</author>

<author> Author 3 </author>

</book>

</bib>

 

The application must generate an XML result that contains an XML element named BookTitle for each book. The text content of the element must contain the title of the book. You need to create a query that generates the new XML result. What should you do?

 

  1. XDocument document = XDocument.Load(“books.xml”);

var query = from node in document.Descendants()

where node.Name.LocalName == “book”

select new XElement(“BookTitle”, node.FirstAttribute.Value);

 

  1. XDocument document = XDocument.Load(“books.xml”);

var query = from node in document.DescendantNodes()

where node.ToString() == “book”

select new XText(“BookTitle” + node.ToString());

 

  1. XDocument document = XDocument.Load(“books.xml”);

var query = from node in document.Descendants()

where node.Name.LocalName == “book”

select new XElement(“BookTitle”).Value = node.FirstAttribute.Value;

 

  1. XDocument document = XDocument.Load(“books.xml”);

var query = from node in document.DescendantNodes()

where node.ToString() == “book”

select new XElement(“BookTitle”, node.ToString());

 

Correct Answer: A

 

 

QUESTION 108

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that uses the Entity Framework. The application has the entity model shown in the following diagram.

 

70-516-demo-18

 

The application must create a projection of the unique set of names and year-to-date sales for territories where at least one sales person had sales last year of more than $100,000. The projection must consist of properties named Sales and Name. You need to write a query that will generate the required projection. Which code segment should you use?

 

  1. (from person in model.SalesPersons

where (person.SalesLastYear > 100000)

select new {

Name = person.SalesTerritory.Name,

Sales = person.SalesTerritory.SalesYTD

}

).Distinct();

 

  1. (from person in model.SalesPersons

where (person.SalesLastYear > 100000)

select new {

Name = person.SalesTerritory.Name,

Sales = person.SalesTerritory.SalesYTD

}

);

 

  1. model.SalesTerritories.Where( t => t.SalesPersons.Any( p => p.SalesLastYear > 100000))

.Select( t=>new { t.Name, t.SalesYTD})< /p>

.Distinct();

  1. model.SalesTerritories.Where( t=> t.SalesPersons.Any( p => p.SalesLastYear > 100000))

.Select( t=>new { t.Name, Sales = t.SalesYTD});

 

Correct Answer: A

 

 

QUESTION 109

You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database. You add the following stored procedure to the database.

 

CREATE PROCEDURE [dbo].[InsertTag]

@Name nvarchar (15)

AS

INSERT INTO [dbo].[Tags] (Name) VALUES(@Name)

RETURN @@ROWCOUNT

You need to invoke the stored procedure by using an open SqlConnection named conn. Which code segment should you use?

 

  1. SqlCommand cmd = new SqlCommand(“EXEC InsertTag”, conn);

cmd.CommandType = CommandType.Text;

cmd.Parameters.AddWithValue(“@Name”, “New Tag 1”);

cmd.ExecuteNonQuery();

 

  1. SqlCommand cmd = new SqlCommand(“EXEC InsertTag”, conn);

cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue(“@Name”, “New Tag 1”);

cmd.ExecuteNonQuery();

 

  1. SqlCommand cmd = new SqlCommand(“InsertTag”, conn);

cmd.CommandType = CommandType.Text;

cmd.Parameters.AddWithValue(“@Name”, “New Tag 1”);

cmd.ExecuteNonQuery();

 

  1. SqlCommand cmd = new SqlCommand(“InsertTag”, conn);

cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue(“@Name”, “New Tag 1”);

cmd.ExecuteNonQuery();

 

Correct Answer: D

 

 

 

 

 

QUESTION 110

You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL Server 2008 database. The database contains a ClassStudent table that contains the StudentID for students who are enrolled in the classes. You add the following stored procedure to the database.

 

CREATE PROCEDURE [dbo].[GetNumEnrolled]

@ClassID INT,

@NumEnrolled INT OUTPUT

AS BEGIN

SET NOCOUNT ON

SELECT @NumEnrolled = COUNT(StudentID)

FROM ClassStudent

WHERE (ClassID = @ClassID)

END

 

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

 

01 private int GetNumberEnrolled(string classID)

02 {

03 using (SqlConnection conn = new SqlConnection(GetConnectionString())

04 {

05 SqlCommand cmd = new SqlCommand(“GetNumEnrolled”, conn);

06 cmd.CommandType = CommandType.StoredProcedure;

07 SqlParameter parClass = cmd.Parameters.Add(“@ClassID”, SqlDbType.Int, 4, “classID”);

08 SqlParameter parNum = cmd.Parameters.Add(“@NumEnrolled”, SqlDbType.Int);

09 …

10 conn.Open()

11 …

12 }

13 }

 

You need to ensure that the GetNumberEnrolled method returns the number of students who are enrolled for a specific class. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

  1. Insert the following code at line 09
    .

parNum.Direction = ParameterDirection.Input;

 

  1. Insert the following code at line 09.

parNum.Direction = ParameterDirection.Output;

 

  1. Insert the following code at line 11.

int numEnrolled = 0;

SqlDataReader reader = cmd.ExecuteReader();

while(reader.Read())

{

numEnrolled = numEnrolled + (int)cmd.Parameters[“@NumEnrolled”].Value;

}

return numEnrolled;

 

  1. Insert the following code at line 11.

cmd.ExecuteNonQuery();

return (int)parNum.Value;

 

Correct Answer: BD

 

Instant Access to Download Latest Complete Collection of Microsoft MCTS 70-516 Real Exam

Try Microsoft MCTS 70-516 Free Demo

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.