Home » New Updated Microsoft MCTS 70-516 Real Exam Questions and Answers Download 141-150

New Updated Microsoft MCTS 70-516 Real Exam Questions and Answers Download 141-150

Ensurepass

QUESTION 141

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. The application uses a Microsoft ADO. NET SQL Server managed provider. When a connection fails, the application logs connection information, including the full connection string. The information is stored as plain text in a .config file. You need to ensure that the database credentials are secure. Which connection string should you add to the .config file?

 

  1. Data Source=myServerAddress; Initial Catalog=myDataBase; Integrated Security=SSPI; Persist Security Info=false;

  2. Data Source=myServerAddress; Initial Catalog=myDataBase; Integrated Security=SSPI; Persist Security Info=true;

  3. Data Source=myServerAddress; Initial Catalog=myDataBase; User Id=myUsername; Password=myPassword; Persist Security Info=false;

  4. Data Source=myServerAddress; Initial Catalog=myDataBase; User Id=myUsername; Password=myPassword; Persist Security Info=true;

 

Correct Answer: A

 

 

QUESTION 142

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 manage order data. The application makes a Web service call to obtain orders from an order-tracking system. You need to ensure that the orders are added to the local data store. Which method should you call on the ObjectContext?

 

  1. Attach

  2. AttachTo

  3. AddObject

  4. ApplyCurrentValues

 

Correct Answer: C

 

 

QUESTION 143

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the Entity Framework Designer to create an Entity Data Model using model-first development. The database has the following requirements:

 

  • each table must have a datetime column named time_modified

  • each table requires a trigger that updates the value of the time_modified column when a row is inserted or updated

 

You need to ensure that the database script that is created by using the Generate Database From Model option meets the requirements. What should you do?

 

  1. Create a new T4 template, and set the DDL Generation template to the name of the new template.

  2. Create a new Windows Workflow Foundation workflow, and set Database Generation Workflow to the name of the new workflow.

  3. Add a DateTime property named time_modified to each entity in the model and set the property’s StoreGeneratedPattern to Computed.

  4. Add a new entity named time_modified to the model, and modify each existing entity so that it inherits from the new entity.

 

Correct Answer: A

 

 

QUESTION 144

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 as shown in the following diagram.

 

70-516-demo-20

 

  • You create an ObjectContext instance named objectContext1 and use it to create a SalesPerson instance named person1.

  • You create an ObjectContext instance named objectContext2 and use it to create a SalesTerritory instance named territory1.

 

You need to create and persist a relationship between person1 and terrotory1. What should you do?

 

  1. Detach person1 from objectContext1.

Attach person1 to objectContext2.

Set the SalesTerritory property of person1 to territory1.

Call SaveChanges on objectContext2.

 

  1. Attach person1 to objectContext2.

Attach territory1 to objectContext1.

Set the SalesTerritory property of person1 to territory1.

Call SaveChanges on both objectContext1 and objectContext2.

 

  1. Detach person1 from objectContext1.

Detach territory1 from objectContext2.

Set the SalesTerritory property of person1 to territory1.

Call Refresh on both objectContext1 and objectContext2.

 

  1. Attach person1 to objectContext2.

Detach territory1 from objectContext2.

Set the SalesTerritory property of person1 to territory1.

Call Refresh on objectContext1.

 

Correct Answer: A

 

 

QUESTION 145

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.

 

70-516-demo-21

 

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?

 

  1. while(count++ < 3)

{

try

{

}

context.SaveChanges();

break;

catch(Exception)

{

}

}

 

  1. while(cust.EntityState == EntityState.Modified)

{

try

{

}

context.SaveChanges();

catch(Exception)

{

Broken

}

}


if(count++ > 2 && context.Connection.State == ConnectionState.

{

throw new Exception();

}

 

  1. while(true)

{

context.SavingChanges += delegate(System.Object o, System.EventArgs e)

{

if(count++ >2)

{

throw new Exception();

}

context.SaveChanges();

}

}

 

  1. while(context.ObjextStateManager.GetObjectStateEntry(cust).OriginalValues.

IsDBNull(0))

{

if(count++ >2)

{

break;

}

context.SaveChanges();

}

 

Correct Answer: B

 

 

QUESTION 146

You have executed the Where query extension method on your collection, and it returned IEnumerable of Car, but you want to assign this to a variable whose type is List Of Car. How can you convert the IEnumerable of Car to List of Car?

 

  1. Use CType (C# cast).

  2. It can’t be done.

  3. Use the ToList() query extension method.

  4. Just make the assignment

 

Correct Answer: C

 

 

QUESTION 147

When working with LINQ to SQL, what is the main object that moves data to and from the database?

 

  1. DataSet

  2. SqlDataAdapter

  3. DataContext

  4. Entity

 

Correct Answer: C

 

 

QUESTION 148

You want to use LINQ to SQL to run queries on a table that contains a column that stores large photos. Most of the time, you won’t need to view the photo, but occasionally you will need to see it. In the LINQ to SQL designer, which property can you set on the photo column to get the efficient loading of the data for most scenarios but still be able to retrieve the photo when needed?

 

  1. Skip

  2. Delay Loaded

  3. Take

  4. Auto Generated Value.

 

Correct Answer: B

 

 

QUESTION 149

You retrieved a row of data into an entity object by using a LINQ to SQL DataContext object. You haven’t made any changes to the object, but you know that someone else has modified the data row in the database table, so you rerun your query, using the same LINQ to SQL DataContext object, to retrieve the updated data. What can be said about the result of the second query?

 

  1. It returns the updated data and you can use it immediately.

  2. The changes are thrown out and you use the cached data, so you don’t see the changes.

  3. An exception is thrown due to the difference in data.

  4. An exception is thrown because you already have the object, so you can’t re-query unless you create a new DataContext object.

Correct Answer: B

 

 

QUESTION 150

You ran a LINQ to SQL query to retrieve the products that you are going to mark as discontinued. After running the query, you looped through the returned products and set their Discontinued property to true. What must you do to ensure that the changes go back to the database?

 

  1. Call the Update method on the DataContext object.

  2. Nothing; the changes are sent when you modify the object.

  3. Call the Dispose method on the DataContext object.

  4. Call the SubmitChanges method on the DataContext object.

 

Correct Answer: D

 

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

Try Microsoft MCTS 70-516 Free Demo

HOT EXAM!
New Updated Microsoft MCTS 70-516 Real Exam Questions and Answers Download 151-160
New Updated Microsoft MCTS 70-516 Real Exam Questions and Answers Download 131-140

Name of author

Name: admin