[Free] Get all latest Microsoft 70-516 Actual Tests 191-200

Ensurepass

QUESTION 191

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.

 

SQLConnection conn = new SQLConnection(connectionString);

conn.Open();

SqlTransaction tran = db.BeginTransaction(IsolationLevel. …);

 

You must retrieve not commited records originate from various transactions. Which method should you use?

 

A.       ReadUncommited

B.       ReadCommited

C.        RepeatableRead

D.       Serializable

 

Correct Answer: A

 

 

QUESTION 192

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You use the ADO.NET Entity Framework to model your entities. The application connects to a Microsoft SQL Server 2008 database named AdventureWorks by using Windows Authentication. Information about the required Entity Data Model (EDM) is stored in the following files:

 

Ÿ   model.csdl

Ÿ   model.ssdl

Ÿ   model.msl

 

These files are embedded as resources in the MyCompanyData.dll file.You need to define the connection string

that is used by the application. Which connection string should you add to the app.config file?

 

A.       <add name=”AdventureWorksEntities”

connectionString=”metadata=res://MyComparny.Data,Culture=neutral,PublicKeyToken=null/model.csdIl

res://MyCompany.Data,Culture=neutral, PublicKeyToken=null/model.ssdl|

res://MyCompany.Data,Culture=neutral, PublicKeyToken=null/model.msl;

provider=System.Data.EntityClient;

provider connection string=’DataSource=localhost;

Initial Catalog=AdventureWorks;lntegrated Security=True;multipleactivesuitsets=true’”

providerName=”System.Data.SqlClient”/>

 

B.       <add name=”AdventureWorksEntities”

connectionString=”metadata=res://MyComparny.Data,Culture=neutral,PublicKeyToken=null/model.csdIl

res://MyCompany.Data,Culture=neutral, PublicKeyToken=null/model.ssdl|

res://MyCompany.Data,Culture=neutral, PublicKeyToken=null/model.msl;

provider=System.Data.SqlClient;

provider connection string=’DataSource=localhost;

Initial Catalog=AdventureWorks;lntegrated Security=True;multipleactivesuitsets=true’”

providerName=”System.Data.EntityClient”/>

 

C.        <add name=”AdventureWorksEntities”

connectionString=”metadata=res://MyComparny.Datamodel.csdl|

res://MyCompany.Data.model.ssdl|

res://MyCompany.Data.model.msl;

provider=System.Data.SqlClient;

provider connection string=’DataSource=localhost;

Initial Catalog=AdventureWorks;lntegrated Security=SSPI;multipleactivesuitsets=true’”

providerName=”System.Data.EntityClient”/>

 

D.       <add name=”AdventureWorksEntities”

connectionString=”metadata=res://MyComparny.Data,Culture=neutral,PublicKeyToken=null/model.csdIl

res://MyComparny.Data,Culture=neutral,PublicKeyToken=null/model.ssdIl res://MyComparny.Data,Culture=neutral,PublicKeyToken=null/model.msl;

provider=System.Data.OleDBClient;

provider connection string=’Provider=sqloledb;DataSource=localhost;

Initial Catalog=AdventureWorks;lntegrated Security=SSPI;multipleactivesuitsets=true’”

providerName=”System.Data.EntityClient”/>

 

Correct Answer: B

 

 

QUESTION 193

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 Data Definition Language (DDL) script of the database contains the following code segment:

 

CREATE TABLE [Sales].[SalesOrderHeader]( [SalesOrderID] [int] IDENTITY(1,1) NOT NULL, [BillToAddressID] [int] NOT NULL,

CONSTRAINT [PK_SalesOrderHeader_SalesOrderID]

PRIMARY KEY CLUSTERED ([SalesOrderID] ASC)

)

 

ALTER TABLE [Sales].[SalesOrderHeader]

WITH CHECK ADD CONSTRAINT [FK_SalesOrderHeader_Address]

FOREIGN KEY([BilIToAddressID])

REFERENCES [Person].[Address]([AddressID])

 

You create an ADO.NET Entity Framework model. You need to ensure that the entities of the model correctly map to the DDL of the database. What should your model contain?

 

 

 

 

 

 

 

 

 

A.

clip_image001

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

B.

clip_image002

 

 

 

 

 

 

 

 

 

 

 

 

 

C.

clip_image003

 

D.

clip_image004

Correct Answer: A

 

 

QUESTION 194

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You create a Database Access Layer (DAL) that is database-independent. The DAL includes the following code segment. (Line numbers are included for reference only.)

 

01 static void ExecuteDbCommand(DbConnection connection)

02 {

03 if (connection != null){

04 using (connection){

05 try{

06 connection.Open();

07 DbCommand command = connection.CreateCommand();

08 command.CommandText = “INSERT INTO Categories (CategoryName) VALUES (‘Low Carb’)”;

09 command.ExecuteNonQuery();

10 }

11 …

12 catch (Exception ex){

13 Trace.WriteLine(“Exception.Message: ” + ex.Message);

14 }

15 }

16 }

17 }

 

You need to log information about any error that occurs during data access. You also need to log the data provider that accesses the database. Which code segment should you insert at line 11?

 

A.       catch (OleDbException

ex){ Trace.WriteLine(“ExceptionType: ” +

ex.Source); Trace.WriteLine(“Message: ” +

ex.Message);

}

 

B.       catch (OleDbException ex){

Trace.WriteLine(“ExceptionType: ” + ex.InnerException.Source);

Trace.WriteLine(“Message: ” + ex.InnerException.Message);

}

 

C.        catch (DbException

ex){ Trace.WriteLine(“ExceptionType: ” +

ex.Source); Trace.WriteLine(“Message: ” +

ex.Message);

}

 

D.       catch (DbException ex){

Trace.WriteLine(“ExceptionType: ” + ex.InnerException.Source);

Trace.WriteLine(“Message: ” + ex.InnerException.Message);

}

 

Correct Answer: C

 

 

QUESTION 195

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 contains a SalesOrderHeader entity. The entity includes an OrderDate property of type DateTime. You need to retrieve the 10 oldest SalesOrderHeaders according to the OrderDate property. Which code segment should you use?

 

A.       var model = new AdventureWorksEntities();

var sales = model.SalesOrderHeaders.Take(10).OrderByDescending(soh => soh.OrderDate);

 

B.       var model = new AdventureWorksEntities();

var sales = model.SalesOrderHeaders.OrderByDescending(soh => soh.OrderDate).Take(10);

 

C.        var model = new AdventureWorksEntities();

var sales = model.SalesOrderHeaders.OrderBy(soh => soh.OrderDate).Take(10);

 

D.       var model = new AdventureWorksEntities();

var sales = model.SalesOrderHeaders.Take(10).OrderBy(soh => soh.OrderDate);

 

Correct Answer: C

 

 

QUESTION 196

You use Microsoft .NET Framework 4.0 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();

11 tran.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 ex)

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?

 

A.       tran.Rollback();

B.       tran.Rollback(“save2”);

tran.Commit();

C.        tran.Rollback();

tran.Commit();

D.       tran.Rollback(“save2”);

 

Correct Answer: B

 

 

QUESTION 197

You use Microsoft .NET Framework 4.0 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

 

 

QUESTION 198

You use 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 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?

 

A.       TimeSpan time = (TimeSpan)rdr[1];

B.       Timer time = (Timer)rdr[1];

C.        string time = (string)rdr[1];

D.       DateTime time = (DateTime)rdr[1];

 

Correct Answer: A

 

 

QUESTION 199

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. The model contains an entity type named Product. You need to ensure that a stored procedure will be invoked when the ObjectContext.SaveChanges method is executed after an attached Product has changed. What should you do in the ADO.NET Entity Framework Designer?

 

A.       Add a new entity that has a base class of Product that is mapped to the stored procedure.

B.       Add a stored procedure mapping for the Product entity type.

C.        Add a complex type named Product that is mapped to the stored procedure.

D.       Add a function import for the Product entity type.

 

Correct Answer: B

 

 

QUESTION 200

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. You deploy the data service to the following URL:

 

http://contoso.com/Northwind.svc.

 

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

 

01 var uri = new Uri(@”http://contoso.com/Northwind.svc/”);

02 var ctx = new NorthwindEntities(uri);

03 var categories = from c in ctx.Categories select c;

04 foreach (var category in categories) {

05 PrintCategory(category);

06 …

07 foreach (var product in category.Products) {

08 …

09 PrintProduct(product);

10 }

11 }

 

You need to ensure that the Product data for each Category object is lazy-loaded. What should you do?

 

 

A.       Add the following code segment at line 06:

ctx.LoadProperty(category, “Products”);

 

B.       Add the following code segment at line 08:

ctx.LoadProperty(product, “*”);

 

C.        Add the following code segment at line 06:

var strPrdUri = string.Format(“Categories({0})?$expand=Products”, category.CategoryID);

var productUri = new Uri(strPrdUri, UriKind.Relative);

ctx.Execute<Product>(productUri);

 

D.       Add the following code segment at line 08:

var strprdUri= string.format(“Products?$filter=CategoryID eq {0}”, category.CategoryID);

var prodcutUri = new Uri(strPrd, UriKind.Relative);

ctx.Execute<Product>(productUri);

 

Correct Answer: A

 

Instant Access to Download Testing Software & PDF File for Microsoft 70-516 Real Exam

Instant Access to Try Microsoft 70-516 Free Demo