All Free Pass4sure PDF & VCE 70-516 Exam Questions (81-90)

QUESTION 81
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. The application contains the following model.
811
Each region contains a single vendor. Customers order parts from the vendor that is located in their region.
You need to ensure that each row in the Customer table references the appropriate row from the Vendor table.
Which code segment should you use?

A.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from v in dc.Vendors
                 join c in dc.Customers on v.VendorlD equals c.VendorID
                 select new { Vendor = v, Customer = c };
foreach (var u in query){
   u.Customer.Region = u.Vendor.Region;
}
dc.SubmitChanges();
B.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from c in dc.Customers
                 join v in dc.Vendors on c.VendorlD equals v.VendorID
                 select new { Customer = c, Vendor = v };
foreach (var u in query){
   u.Vendor.Region = u.Customer.Region;
}
dc.SubmitChanges();
C.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from v in dc.Vendors
                 join c in dc.Customers on v.Region equals c.Region
                 select new { Vendor = v, Customer = c };
foreach (var u in query){
   u.Customer.VendorlD = u.Vendor.VendorlD;
}
dc.SubmitChanges();
D.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from c in dc.Customers
                 join v in dc.Vendors on c.Region equals v.Region
                 select new { Customer = c. Vendor = v };
foreach (var u in query){
   u.Vendor.VendorlD = u.Customer.VendorID;
}
dc.SubmitChanges();

Answer: C

QUESTION 82
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 200B database.
You populate a SqlDataAdapter by using the following code. (Line numbers are included for reference only.)
01 SqlDataAdapter dataAdapter1 = new SqlDataAdapter(“SELECT * FROM [BlogEntries] ORDER BY CreationDate”, connection);
02 cmdBuilder = new SqlCommandBuilder(dataAdapter1);
03 dataAdapter1.Fill(BlogEntryDataSet, “BlogEntries”);
04 ….
05 connection.Close();
You need to update the blog owner for all BlogEntry records. Which code segment should you insert at line 04?

A.    foreach(DataRow row in BlogEntryDataSet.Tables[“BlogEntries”].Rows)
{
   row.Item[“BlogOwner””] = “New Owner”;
}
dataAdapter1.Update(BlogEntryDataSet, “BlogEntries”);
B.    foreach(DataRow row in BlogEntryDataSet.Tables[“BlogEntries”].Rows)
{
   row.Item[“BlogOwner””] = “New Owner”;
}
dataAdapter1.Fill(BlogEntryDataSet, “BlogEntries”);
C.    SqlDataAdapter dataAdapter2 = new SqlDataAdapter(“UPDATE [BlogEntries] SET [BlogOwner] = “New ‘Owner’ 3″,
connection);
dataAdapter2.Update(BlogEntryDataSet, “BlogEntries”);
D.    SqlDataAdapter dataAdapter2 = new SqlDataAdapter(dataAdapterl.UpdateCommand);
dataAdapter2.Fill(BlogEntryDataSet, “BlogEntries”);

Answer: A

QUESTION 83
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL.
The application contains the following model. You write the following code. (Line numbers are included for reference only.)
01 static void Insert()
02 {
03    NorthwindDataContext dc = new NorthwindDataContext();
04    Customer newCustomer = new Customer();
05    newCustomer.Firstname = “Todd”;
06    newCustomer.Lastname = “Meadows”;
07    newCustomer.Email = “[email protected]”;
08    …..
09    dc.SubmitChanges();
10 }
831
A product named Bike Tire exists in the Products table. The new customer orders the Bike Tire product.
You need to ensure that the correct product is added to the order and that the order is associated with the new customer.
Which code segment should you insert at line 08?

A.    Order newOrder = new Order();
newOrder.Product = (from p in dc.Products
                               where p.ProductName == “Bike Tire”
                               select p) .First();
B.    Product newProduct = new Product();
newProduct.ProductName = “Bike Tire”;
Order newOrder = new Order();
newOrder.Product = newProduct;
C.    Product newProduct = new Product();
newProduct.ProductName = “Bike Tire”;
Order newOrder = new Order ();
newOrder.Product = newProduct;
newCustomer.Orders.Add(newOrder) ;
D.    Order newOrder = new Order();
newOrder.Product = (from p in dc.Products
                               where p.ProductName == “Bike Tire”
                               select p).First();
newCustomer.Orders.Add(newOrder) ;

Answer: D

QUESTION 84
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application that connects to a database by using the Entity Framework.
You create an Entity Data Model (EDM) by using the Generate from database wizard for the following tables.
841
You need to ensure that the EDM contains an entity type named Employee that contains all of the data from both tables.
What should you do?

A.    Delete the EmployeeAccess entity, create a new property named CanAccessBuildings on the Employee entity, and add a mapping for the new property.
B.    Create an inheritance relationship between the Employee and EmployeeAccess entities, and use CanAccessBuildings as an inheritance condition.
C.    Modify the .edmx file to include the following line of code.
<NavigationProperty Name=”Type” FromRole=”EmployeeAccess” ToRole=”Employee” />
D.    Create a one-to-one association named CanAccessBuildingsAssociation between the EmployeeAccess entity and the Employee entity.

Answer: A

QUESTION 85
When working with a data set that has data in it, you decide you want to store the schema, but not the data, of the data set to a file so you can share the schema with other users. Which method must you execute to store the schema?

A.    InferXmlSchema
B.    ReadXmlSchema
C.    WriteXmlSchema
D.    WriteXml

Answer: C

QUESTION 86
Before you can execute a command on a connection object, which method must you execute to prepare the connection?

A.    Open
B.    BeginTransaction
C.    GetSchema
D.    Close

Answer: A

QUESTION 87
You want to set up a secure connection between your application and SQL Server. SQL Server has a trusted certificate that is set up properly. What must you do?

A.    Execute BeginTransaction on the command object.
B.    Add Encrypt=true to the connection string.
C.    Encrypt the CommandText property on the command object.
D.    Close the connection before sending the command.

Answer: B

QUESTION 88
You want to secure the connection strings contained within your Web.config file to ensure that no one can open the file easily and see the connection information. Which tool must you use to encrypt the connection strings?

A.    ASPNET_REGSQL.EXE
B.    CASPOL.EXE
C.    INSTALLUTIL.EXE
D.    ASPNET_REGIIS.EXE.

Answer: D

QUESTION 89
You are going to execute a Select command to SQL Server that returns several rows of customer data. You don’t need a data table to hold the data because you will simply loop over the returned results to build a string of information that will be displayed to the user. You create and open a connection and then create the command and set its properties. Which method on the command will you execute to retrieve the results?

A.    ExecuteScalar
B.    Close
C.    ExecuteReader
D.    ExecuteNonQuery

Answer: C

QUESTION 90
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the Entity Framework Designer to create the following Entity Data Model.
901
You write a method named ValidatePostalCode to validate the postal code for the application.
You need to ensure that the ValidatePostalCode method is called before the PostalCode property set method is completed and before the underlying value has changed.
Which code segment should you place in the entity’s partial class?

A.    partial void OnPostalCodeChanged(string value)
{
   PostalCode = GetValidValue<string>(value, “ValidatePostalCode”, false, true) ;
}
B.    public string ValidatedPostalCode
{
   set
   {
      ValidatePostalCode(value);
      _PostalCode = value;
   }
   get
   {
      return _PostalCode;
   }
}
C.    partial void OnPostalCodeChanging(string value)
{
   ValidatePostalCode(value);
}
D.    public string ValidatedPostalCode
{
   set
   {
      _PostalCode = StructuralObject.SetValidValue(“ValidatePostalCode”, false);
   }
   get
   {
      return _PostalCode;
   }
}

Answer: C

All Free Pass4sure PDF & VCE 70-516 Exam Questions