[Free] New Updated (October) Microsoft 70-516 Real Exam 101-110

Ensurepass

 

QUESTION 101

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

 

<bib>

 

<book title3″Ercgranraing in Unix” yeai=”1992*,>

 

<author> Author1</author >

 

<author>Author2</author>

 

<author>Author3</author>

 

</book>

 

</bib>

 

The application must generate an XML result that contains an XML element named DookTitle for each book. The text content of must contain the title of the book.

 

You need to create a query that generates the new XML result.

 

Which code segment should you use?

A.

XDocument document = XDocument.Lcad(“books.xml”);

var query = from node in document.Descendants()

where node.Name.LocalName == “book”

select new XElement (“BookTitle”,

node.FirstAttrlbute.Value);

B.

XDocument document = XDocument.Lead(“books.xml”);

var query = from node in document.DescendantNodes()

where node.ToString() == “book”

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

C.

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

var query = from node in document.Descendants()

where node.Name.LocalName = “book”

select new XElement(“BookTitle”).Value =

node.FlrstAttrlbute.Value;

D.

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

var query = from node in document.DescendantNodes()

where node.ToStrmg () == “book”

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

 

Correct Answer: A

 

 

QUESTION 102

You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database.

 

You use the ADO.NET LINQ to SQL model to retrieve data from the database.

 

You use stored procedures to return multiple result sets.

 

You need to ensure that the result sets are returned as strongly typed values.

 

What should you do?

 

A.

Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use the GetResult<TElement> method to obtain an enumerator of the correct type.

B.

Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directly access the strongly typed object from the results collection.

C.

Apply the ResultTypeAttribute to the stored procedure function and directly access the strongly typed object from the results collection.

D.

Apply the ParameterAttribute to the stored procedure function. Use the GetResult<TElement> method to obtain an enumerator of the correct type.

 

Correct Answer: A

Explanation:

You must use the IMultipleResults.GetResult<TElement> Method pattern to obtain an enumerator of the correct type, based on your knowledge of the stored procedure. FunctionAttribute Associates a method with a stored procedure or user-defined function in the database.

IMultipleResults.GetResult<TElement> Method

http://msdn.microsoft.com/en-us/library/bb534218.aspx

 

 

 

 

 

QUESTION 103

You use Microsoft .NET Framework 4 to develop an application.

 

The configuration file contains the following code segment.

 

<configuration>

 

<connectionStrings>

 

<add name=”AdventureWorksLT”

 

connectionString=”Data Source=SQL01;

 

Initial Catalog=AdventureWorksLT;

 

Integrated Security=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?

 

A.

var connectionString = ConfigurationManager

.ConnectionStrings[“AdventureWorksLT”].ConnectionString;

B.

var connectionString = ConfigurationManager

.ConnectionStrings[“AdventureWorksLT”].Name;

C.

var connectionString = ConfigurationManager

.AppSettings[“AdventureWorksLT”];

D.

var connectionString = ConfigurationSettings

.AppSettings[“AdventureWorksLT”];

 

Correct Answer: A

 

 

QUESTION 104

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 ObjectCache (

 

Id INT IDENTITY PRIMARY KEY,

 

SerializedObjectData XML )

 

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

 

01 string s = GetConnectStringFromConfigFile(“xmldb”);

 

02 using (SqlConnection conn = new SqlConnection(s))

 

03 using (SqlCommand cmd = new SqlCommand(

 

04 “select * from ObjectCache”, conn))

 

05 {

 

06 conn.Open();

 

07 SqlDataReader rdr = cmd.ExecuteReader();

 

08 while(rdr.Read())

 

09 {

 

10

 

11 DeserializeObject(obj);

 

12 }

 

13 }

 

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

 

A.

XmlReader obj = (XmlReader)rdr[1];

B.

SByte obj = (SByte)rdr[1];

C.

String obj = (String)rdr[1];

D.

Type obj = rdr[1].GetType();

 

Correct Answer: C

 

 

QUESTION 105

You use Microsoft .NET Framework 4 to develop an application that uses WCF Data Services to retrieve entities.

 

WCF Data Services uses an authentication scheme that requires an HTTP request that has the following header format.

 

GET /OData.svc/Products(1)

 

Authorization: WRAP access_token=”123456789″

 

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

 

01 public class Program

 

02 {

 

03 public void GetProducts()

 

04 {

 

05 var proxy = new MyDataServiceContext();

 

06

 

07 …

 

08 }

 

09

 

10 }

 

You need to ensure that the correct authentication header is present when requests are made by using MyDataServiceContext.

 

What should you do?

 

A.

Insert the following code segment at line 06.

proxy.Credentials = new NetworkCredential

(“WRAP access_token”, “123456789”);

B.

Insert the following code segment at line 06.

proxy.Credentials = new NetworkCredential

(“Authorization”, “WRAP access_token=”123456789″”);

C.

Insert the following code segment at line 06.

proxy.SendingRequest += new

EventHandler<SendingRequestEventArgs>

(proxy_SendingRequest);

Insert the following code segment at line 09.

void proxy_SendingRequest(object sender,

SendingRequestEventArgs e) {

D.

RequestHeaders.Add(“WRAP access_token”, 123456789″); }

E.

Insert the following code segment at line 06.

proxy.SendingRequest += new EventHandler

<SendingRequestEventArgs>(proxy_SendingRequest);

Insert the following code segment at line 09.

void proxy_SendingRequest(object sender,

SendingRequestEventArgs e)

{

F.

RequestHeaders.Add(“Authorization”,

“WRAP access_token=”123456789″”);

}

 

Correct Answer: D

 

 

QUESTION 106

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 GetSalesPeople

 

AS

 

BEGIN

 

SELECT FirstName, LastName, Suffix, Email, Phone

 

FROM SalesPeople

 

END

 

You write the following code. (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 retrieve all of the results from the stored procedure.

 

Which code segment should you insert at line 04?

 

A.

var res = command.ExecuteReader();

B.

var res = command.ExecuteScalar();

C.

var res = command.ExecuteNonQuery();

D.

var res = command.ExecuteXmlReader();

 

Correct Answer: A

Explanation:

ExecuteReader Sends the CommandText to the Connection and builds a SqlDataReader.

SqlCommand Class

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx

 

 

QUESTION 107

You use Microsoft .NET Framework 4 to develop an application. You use the XmlReader class to load XML from a location that you do not control.

 

You need to ensure that loading the XML will not load external resources that are referenced in the XML.

 

Which code segment should you use?

 

A.

XmlReaderSettings settings = new XmlReaderSettings();

settings.ValidationType = ValidationType.None;

XmlReader reader = XmlReader.Create(“data.xml”, settings);

B.

XmlReaderSettings settings = new XmlReaderSettings();

settings.CheckCharacters = true;

XmlReader reader = XmlReader.Create(“data.xml”, settings);

C.

XmlReaderSettings settings = new XmlReaderSettings();

settings.XmlResolver = null;

XmlReader reader = XmlReader.Create(“data.xml”, settings);

D.

XmlReaderSettings settings = new XmlReaderSettings();

settings.ConformanceLevel = ConformanceLevel.Auto;

XmlReader reader = XmlReader.Create(“data.xml”, settings);

Correct Answer: C

Explanation:

CheckCharacters Gets or sets a value indicating whether to do character checking. ConformanceLevel Gets or sets the level of conformance which the XmlReader will comply. ValidationType Gets or sets a value indicating whether the XmlReader will perform validation or type assignment when reading.

XmlResolver Sets the XmlResolver used to access external documents.

XmlReaderSettings Class

http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.aspx

http://stackoverflow.com/questions/215854/prevent-dtd-download-when-parsing-xml

http://msdn.microsoft.com/en-us/library/x1h1125x.aspx

 

 

QUESTION 108

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application.

 

You deploy a Windows Communication Foundation (WCF) Data Service to a production server. The application is hosted by Internet Information Services (IIS).

 

After deployment, applications that connect to the service receive the following error message:

 

“The server encountered an error processing the request. See server logs for more details.”

 

You need to ensure that the actual exception data is provided to client computers.

 

What should you do?

 

A.

Add the ServiceBehavior attribute to the class that implements the data service.

B.

Add the FaultContract attribute to the class that implements the data service.

C.

Modify the applications Web.config file. Set the value for the customErrors element to Off.

D.

Modify the applications Web.config file. Set the value for the customErrors element to RemoteOnly.

 

Correct Answer: A

Explanation:

Apply the ServiceBehaviorAttribute attribute to a service implementation to specify service-wide execution behavior.

The IncludeExceptionDetailInFaults property specifies whether unhandled exceptions in a service are returned as SOAP faults. This is for debugging purposes only.

ServiceBehavior Attribute

http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.aspx

FaultContract Attribute

http://msdn.microsoft.com/en-us/library/ms752208.aspx

[ServiceContract(Namespace=”http://Microsoft.ServiceModel.Samples”)]

public interface ICalculator

{

[OperationContract]

int Add(int n1, int n2);

[OperationContract]

int Subtract(int n1, int n2);

[OperationContract]

int Multiply(int n1, int n2);

[OperationContract]

[FaultContract(typeof(MathFault))]

int Divide(int n1, int n2);

}

The FaultContractAttribute attribute indicates that the Divide operation may return a fault of type MathFault. A fault can be of any type that can be serialized. In this case, the MathFaul

t is a data contract, as follows:

[DataContract(Namespace=”http://Microsoft.ServiceModel.Samples”)]

public class MathFault

{

private string operation;

private string problemType;

[DataMember]

public string Operation

{

get { return operation; }

set { operation = value; }

}

[DataMember]

public string ProblemType

{

get { return problemType; }

set { problemType = value; }

}

}

 

 

QUESTION 109

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 use the ADO.NET Entity Framework to model entities.

 

You need to add a new type to your model that organizes scalar values within an entity.

 

You also need to map stored procedures for managing instances of the type.

 

What should you do?

 

A.

Add the stored procedures in the SSDL file along with a Function attribute.

Define a complex type in the CSDL file.

Map the stored procedure in the MSL file with a ModificationFunctionElement.

B.

Add the stored procedures in the SSDL file along with a Function attribute.

Define a complex type in the CSDL file.

Map the stored procedure in the MSL file with an AssociationEnd element.

C.

Use the edmx designer to import the stored procedures.

Derive an entity class from the existing entity as a complex type.

Map the stored procedure in the MSL file with an AssociationEnd element.

D.

Add the stored procedures in the SSDL file along with a Function attribute.

Derive an entity class from the existing entity as a complex type.

Map the stored procedure in the MSL file with a ModificationFunctionElement.

 

Correct Answer: A

Explanation:

EndProperty Element (MSL)

http://msdn.microsoft.com/en-us/library/bb399578.aspx

AssosiationEnd Attribute

http://msdn.microsoft.com/en-us/library/cc716774.aspx

 

QUESTION 110

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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?

 

A.

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

B.

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

C.

Create a custom data class that is sealed.

D.

Create a custom data class that is abstract.

 

Correct Answer: A

Free VCE & PDF File for Microsoft 70-516 Real Exam

Instant Access to Free VCE Files: MCSE|MCSA|MCITP…
Instant Access to Free PDF Files: MCSE|MCSA|MCITP…