[Pass Ensure VCE Dumps] PassLeader Premium 286q 70-516 Braindump For Free Share (161-180)

What are the new 70-516 exam questions? And Where to download the latest 70-516 exam dumps? Now, PassLeader have been publised the new version of 70-516 braindumps with new added 70-516 exam questions. PassLeader offer the latest 70-516 PDF and VCE dumps with New Version VCE Player for free download, and PassLeader’s new 286q 70-516 practice tests ensure your exam 100 percent pass. Visit www.passleader.com to get the 100 percent pass ensure 286q 70-516 exam questions!

keywords: 70-516 exam,286q 70-516 exam dumps,286q 70-516 exam questions,70-516 pdf dumps,70-516 vce dumps,70-516 braindumps,70-516 practice tests,70-516 study guide,TS: Accessing Data with Microsoft .NET Framework 4 Exam

QUESTION 161
The database contains orphaned Color records that are no longer connected to Part records. You need to clean up the orphaned records. You have an existing ContosoEntities context object named context. Which code segment should you use?

A.    var unusedColors = context.Colors.
Where(c => !c.Parts.Any()).ToList();
foreach (var unused in unusedColors){
  context.DeleteObject(unused)
}
context.SaveChanges();
B.    context.Colors.TakeWhile(c => !c.Parts.Any());
context.SaveChanges();
C.    context.Colors.ToList().RemoveAll(c => !c.Parts.Any());
context.SaveChanges();
D.    var unusedColors = context.Colors.Where(c => !c.Parts.Any());
context.DeleteObject(unusedColors);
context.SaveChanges();

Answer: A

QUESTION 162
You need to write a LINQ query that can be used against a ContosoEntities context object named context to find all parts that have a duplicate name. Which of the following queries should you use? (Each correct answer presents a complete solution. Choose two).

A.    context.Parts.Any(p => context.Parts.Any(q => p.Name == q.Name));
B.    context.Parts.GroupBy(p => p.Name).Where(g => g.Count() > 1).
SelectMany(x => x);
C.    context.Parts.SelectMany(p => context.Parts.
Select(q => p.Name == q.Name && p.Id != q.Id));
D.    context.Parts.Where(p => context.Parts.Any(q =>
q.Name == p.Name && p.Id != q.Id);

Answer: BD

QUESTION 163
You add a table to the database to track changes to part names. The table stores the following row values:
– the username of the user who made the change a part ID
– the new part name a DateTime value
You need to ensure detection of unauthorized changes to the row values. You also need to ensure that database users can view the original row values.

A.    Add a column named signature.
Use System.Security.Cryptography.
RSA to create a signature for all of the row values.
Store the signature in the signature column.
Publish only the public key internally.
B.    Add a column named hash.
Use System.Security.Cryptography.MD5 to create an MD5 hash of the row values, and store in the hash column.
C.    Use System.Security.Cryptography.RSA to encrypt all the row values.
Publish only the key internally.
D.    Use System.Security.Cryptography.DES to encrypt all the row values using an encryption key held by the application.

Answer: A

QUESTION 164
Drag and Drop Question
The user interface requires that a paged view be displayed of all the products sorted in alphabetical order. The user interface supplies a current starting index and a page size in variables named startIndex and pageSize of type int. You need to construct a LINQ expression that will return the appropriate Parts from the database from an existing ContosoEntities context object named context. You begin by writing the following expression:
context.Parts
Which query parts should you use in sequence to complete the expression? (To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)

A.    .OrderBy(x => x.Name)
B.    .Skip(pageSize)
C.    .Skip(startIndex)
D.    .Take(pageSize);
E.    .Take(startIndex)

Answer: ACD

QUESTION 165
You are developing a new feature in the application to display a list of all bundled products. You need to write a LINQ query that will return a list of all bundled products. Which query expression should you use?

A.    context.Parts.Cast<Product>()
.Where(p => p.Descendants.Any(d => d is Product))
B.    context.Parts.OfType<Product>()
.Where(p => p.Descendants.Any(d => d is Product))
C.    context.Parts.Cast<Product>()
.ToList()
.Where(p => p.Descendants.Any(d => d is Product))
D.    context.Parts.OfType<Product>()
.ToList()
.Where(p => p.Descendants.Any(d => d is Product))

Answer: D
Explanation:
OfType() Filters the elements of an IEnumerable based on a specified type.
Enumerable.OfType<TResult> Method
http://msdn.microsoft.com/en-us/library/bb360913.aspx

QUESTION 166
You use Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. The Product entity in the LINQ to SQL model contains a field named Productlmage. The Productlmage field holds a large amount of binary data. You need to ensure that the Productlmage field is retrieved from the database only when it is needed by the application. What should you do?

A.    Set the Update Check property on the Productlmage property of the Product entity to Never.
B.    Set the Auto-Sync property on the Productlmage property of the Product entity to Never.
C.    Set the Delay Loaded property on the Productlmage property of the Product entity to True.
D.    When the context is initialized, specify that the Productlmage property should not be retrieved by using DataLoadOptions

Answer: C
Explanation:
Lazy loading is configured in the LINQ to SQL designer by selecting an entity and then, in the Properties window, setting the Delay Loaded property to true.The Delay Loaded property indicates that you want lazy loading of the column.
CHAPTER 4 LINQ to SQL
Lesson 1: What Is LINQ to SQL?
Eager Loading vs. Lazy Loading (page 254)
http://geekswithblogs.net/AzamSharp/archive/2008/03/29/120847.aspx
http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx

QUESTION 167
You use Microsoft .NET Framework 4.0 to develop an application that uses Entity Framework. The application includes the following Entity SQL (ESQL) query.
SELECT VALUE product
FROM AdventureWorksEntities.Products AS product
ORDER BY product.ListPrice
You need to modify the query to support paging of the query results. Which query should you use?

A.    SELECT TOP Stop VALUE product
FROM AdventureWorksEntities.Products AS product
ORDER BY product.ListPrice
SKIP @skip
B.    SELECT VALUE product
FROM AdventureWorksEntities.Products AS product
ORDER BY product.ListPrice
SKIP @skip LIMIT @limit
C.    SELECT SKIP @skip VALUE product
FROM AdventureWorksEntities.Products AS product
ORDER BY product.ListPrice
LIMIT @limit
D.    SELECT SKIP @skip TOP Stop VALUE product
FROM AdventureWorksEntities.Products AS product
ORDER BY product.ListPrice

Answer: B
Explanation:
Entity SQL Reference
http://msdn.microsoft.com/en-us/library/bb387118.aspx
How to: Page Through Query Results
http://msdn.microsoft.com/en-us/library/bb738702.aspx

QUESTION 168
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. The application contains a class as shown in the following code segment. (Line numbers are included for reference only.)
01 public class MyBaseClass : EntityObject
02 {
03    ….
04 }
You need to ensure that all generated entities inherit from MyBaseClass. What should you do?

A.    Change MyBaseClass to inherit from ObjectContext.
B.    Create a new ObjectQuery that uses MyBaseClass as the type parameter.
C.    Modify the generated code file so that all entities inherit from MyBaseClass.
D.    Use the ADO.NET EntityObject Generator template to configure all entities to inherit from MyBaseClass.

Answer: D
Explanation:
You can use the Text Template Transformation Toolkit (T4) to generate your entity classes, and Visual Studio .
NET provides the T4 EntityObject Generator template by which you can control the entity object generation.
Visual Studio .NET also provides the T4 SelfTracking Entity Generator template by which you can create and control the Add an EntityObject Generator to your project and add the new modification to the text template.self-tracking entity classes. Add an EntityObject Generator to your project and add the new modification to the text template.
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
The EntityObject Generator (page 403-404)
http://blogs.msdn.com/b/efdesign/archive/2009/01/22/customizing-entity-classes-with-t4.aspx

QUESTION 169
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. The application defines the following Entity Data Model. Within the .edmx file, the following function is defined:
<Function Name=”Round” ReturnType=”Decimal”>
   <Parameter Name=”val” Type=”Decimal” />
   <DefiningExpression>
         CAST(val as Edm.Int32)
   </DefiningExpression>
</Function>
The application includes the following LINQ query.
var query = from detail in context.SalesOrderDetails
            select detail.LineTotal.Round();
You need to ensure that the Round function executes on the database server when the query is executed. Which code segment should you use?

A.    public static class DecimalHelper
{
   [EdmFunction(“SqlServer”, “Round”)]
   public static Decimal Round(this Decimal Amt)
   {
      throw new NotSupportedException();
   }
}
B.    public static class DecimalHelper
{
   [EdmFunction(“Edm”, “Round”)]
   public static Decimal Round(this Decimal Amt)
   {
      throw new NotSupportedException();
   }
}
C.    public static class DecimalHelper
{
   public static SqlDecimal Round(this Decimal input)
   {
      return SqlDecimal.Round(input, 0);
   }
}
D.    public static class DecimalHelper
{
   public static Decimal Round(this Decimal input)
   {
      return (Decimal)(Int32)input;
   }
}

Answer: B
Explanation:
EdmFunctionAttribute Class
http://msdn.microsoft.com/en-us/library/system.data.objects.dataclasses.edmfunctionattribute.aspx
How to: Call Model-Defined Functions in Queries
http://msdn.microsoft.com/en-us/library/dd456857.aspx
The model-defined function has been created in the conceptual model, but you still need a way to connect your code to it. To do so, add a function into your C# code, which will have to be annotated with the EdmFunctionAttribute attribute. This function can be another instance method of the class itself, but best practice is to create a separate class and define this method as static.

QUESTION 170
You use Microsoft .NET Framework 4.0 to develop an application. You write the following code to update data in a Microsoft SQL Server 2008 database. (Line numbers are included for reference only.)
01 private void ExecuteUpdate(SqlCommand cmd, string connString, string updateStmt)
02 {
03     …
04 }
You need to ensure that the update statement executes and that the application avoids connection leaks. Which code segment should you insert at line 03?

A.    SqlConnection conn = new SqlConnection(connString);
conn.Open();
cmd.Connection = conn;
cmd.CommandText = updateStmt;
cmd.ExecuteNonQuery();
cmd.Connection.Close() ;
B.    using (SqlConnection conn = new SqlConnection(connString))
{
   cmd.Connection = conn;
   cmd.CommandText = updateStmt;
   cmd.ExecuteNonQuery();
   cmd.Connection.Close();
}
C.    using (SqlConnection conn = new SqlConnection(connString))
{
   conn.Open() ;
   cmd.Connection = conn;
   cmd.CommandText = updateStmt;
   cmd.ExecuteNonQuery() ;
}
D.    SqlConnection conn = new SqlConnection(connString);
conn.Open();
cmd.Connection = conn;
cmd.CommandText = updateStmt;
cmd.ExecuteNonQuery();

Answer: C
Explanation:
http://stackoverflow.com/questions/376068/does-end-using-close-an-open-sql-connection
http://www.w3enterprises.com/articles/using.aspx
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx


http://www.passleader.com/70-516.html

QUESTION 171
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 (EDM). You need to create a database creation script for the EDM. What should you do?

A.    Use a new Self-Tracking Entities template.
B.    Drag entities to Server Explorer.
C.    Run the Generate Database command.
D.    Select Run Custom Tool from the solution menu.

Answer: C
Explanation:
You can generate the database from the conceptual model: Right-click the Entity Framework designer surface and then choose Generate Database From Model. The script has been created and saved to a file, but it has not been executed.
Model First
http://blogs.msdn.com/b/efdesign/archive/2008/09/10/model-first.aspx

QUESTION 172
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database. You need to ensure that the application connects to the database server by using SQL Server authentication. Which connection string should you use?

A.    SERVER=MyServer; DATABASE=AdventureWorks;
Integrated Security=SSPI; UID=sa; PWD=secret;
B.    SERVER=MyServer; DATABASE=AdventureWorks;
UID=sa; PWD=secret;
C.    SERVER=MyServer; DATABASE=AdventureWorks;
Integrated Security=false;
D.    SERVER=MyServer; DATABASE=AdventureWorks;
Trusted Connection=true;

Answer: B
Explanation:
SQL Server autentification using the passed-in user name and password.
User ID, Uid, User, Password, Pwd Connection String Syntax (ADO.NET)
http://msdn.microsoft.com/en-us/library/ms254500.aspx

QUESTION 173
You use Microsoft .NET Framework 4.0 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.GetClassAndStudents
AS
BEGIN
SELECT * FROM dbo.Class
SELECT * FROM dbo.Student
END
You create a SqIConnection named conn that connects to the database. You need to fill a DataSet from the result that is returned by the stored procedure. The first result set must be added to a DataTable named Class, and the second result set must be added to a DataTable named Student. Which code segment should you use?

A.    DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ds.Tables.Add(“Class”);
ds.Tables.Add(“Student”);
ad.Fill(ds);
B.    DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ad.TableMappings.Add(“Table”, “Class”);
ad.TableMappings.Add(“Table1”, “Student”) ;
ad.Fill(ds) ;
C.    DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ad.MissingMappingAction = MissingMappingAction.Ignore;
ad.Fill(ds, “Class”);
ad.Fill(ds, “Student”);
D.    DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“GetClassAndStudents”, conn);
ad.Fill(ds);

Answer: B
Explanation:
http://msdn.microsoft.com/en-us/library/ms810286.aspx

QUESTION 174
You use Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. The application defines the following Entity SQL (ESQL) query, which must be executed against the mode.
string prodQuery = “select value p from Products as p where p.ProductCategory.Name = @p0″;
You need to execute the query. Which code segment should you use?

A.    var prods = ctx.CreateQuery<Product>(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();
B.    var prods = ctx.ExecuteStoreCommand(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();
C.    var prods = ctx.ExecuteFunction<Product>(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();
D.    var prods = ctx.ExecuteStoreQuery<Product>(prodQuery,
new ObjectParameter(“p0″, “Road Bikes”)).ToList();

Answer: A
Explanation:
CreateQuery<T>-Creates an ObjectQuery<T> in the current object context by using the specified query string.
ExecuteStoreCommand-Executes an arbitrary command directly against the data source using the existing connection.
ExecuteFunction(String, ObjectParameter[])-Executes a stored procedure or function that is defined in the data source and expressed in the conceptual model; discards any results returned from the function; and returns the number of rows affected by the execution. ExecuteStoreQuery<TElement>(String, Object[])-Executes a query directly against the data source that returns a sequence of typed results.
ObjectContext.CreateQuery<T> Method
http://msdn.microsoft.com/en-us/library/bb339670.aspx

QUESTION 175
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database. The application uses nested transaction scopes. An inner transaction scope contains code that inserts records into the database. You need to ensure that the inner transaction can successfully commit even if the outer transaction rolls back. What are two possible TransactionScope constructors that you can use for the inner transaction to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

A.    TransactionScope(TransactionScopeOption.Required)
B.    TransactionScope()
C.    TransactionScope(TransactionScopeOption.RequiresNew)
D.    TransactionScope(TransactionScopeOption.Suppress)

Answer: CD
Explanation:
Required-A transaction is required by the scope.
It uses an ambient transaction if one already exists.
Otherwise, it creates a new transaction before entering the scope.
This is the default value.
RequiresNew-A new transaction is always created for the scope.
Suppress-The ambient transaction context is suppressed when creating the scope.
All operations within the scope are done without an ambient transaction context.
TransactionScopeOption Numeration
http://msdn.microsoft.com/en-us/library/system.transactions.transactionscopeoption.aspx

QUESTION 176
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 database includes a table that contains information about all the employees. The database table has a field named EmployeeType that identifies whether an employee is a Contractor or a Permanent employee. You declare the Employee entity base type. You create a new Association entity named Contractor that inherits the Employee base type. You need to ensure that all Contractors are bound to the Contractor class. What should you do?

A.    Modify the .edmx file to include the following line of code:
<NavigationProperty Name=”Type” FromRole=”EmployeeType” ToRole=”Contractor” />
B.    Modify the .edmx file to include the following line of code:
<Condition ColumnName=”EmployeeType” Value=”Contractor” />
C.    Use the Entity Data Model Designer to set up an association between the Contractor class and EmployeeType.
D.    Use the Entity Data Model Designer to set up a referential constraint between the primary key of the Contractor class and EmployeeType.

Answer: B
Explanation:
<Association Name=”FK_OrderDetails_Orders1″>
<End Role=”Orders” Type=”StoreDB.Store.Orders” Multiplicity=”1″>
<OnDelete Action=”Cascade” />
</End>
<End Role=”OrderDetails” Type=”StoreDB.Store.OrderDetails” Multiplicity=”*” /> <ReferentialConstraint>
<Principal Role=”Orders”>
<PropertyRef Name=”ID” />
</Principal>
<Dependent Role=”OrderDetails”>
<PropertyRef Name=”OrderId” />
</Dependent>
</ReferentialConstraint>
</Association>

QUESTION 177
You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4.0 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.

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 178
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You create stored procedures by using the following signatures:
CREATE procedure [dbo].[Product_Insert](@name varchar(50),@price float)
CREATE procedure [dbo].[Product_Update](@id int, @name varchar(50), @price float)
CREATE procedure [dbo].[Product_Delete](@id int)
CREATE procedure [dbo].[Order_Insert](@productId int, @quantity int)
CREATE procedure [dbo].[Order_Update](@id int, @quantity int,@originalTimestamp timestamp)
CREATE procedure [dbo].[Order_Delete](@id int)
You create a Microsoft ADO.NET Entity Data Model (EDM) by using the Product and Order entities as shown in the exhibit. You need to map the Product and Order entities to the stored procedures. To which two procedures should you add the @productId parameter? (Each correct answer presents part of the solution. Choose two.)

A.    Product_Delete
B.    Product_Update
C.    Order_Delete
D.    Order_Update

Answer: CD

QUESTION 179
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You use Plain Old CLR objects (POCO) to model your entities. The application communicates with a Windows Communication Foundation (WCF) Data Services service. You need to ensure that entities can be sent to the service as XML. What should you do?

A.    Apply the virtual keyword to the entity properties.
B.    Apply the [Serializable] attribute to the entities.
C.    Apply the [DataContract(IsReference = true)] attribute to the entities.
D.    Apply the [DataContract(IsReference = false)] attribute to the entities.

Answer: C
Explanation:
DataContractAttribute Specifies that the type defines or implements a data contract and is serializable by a serializer, such as the DataContractSerializer. To make their type serializable, type authors must define a data contract for their type. IsReference Gets or sets a value that indicates whether to preserve object reference data.

QUESTION 180
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application uses the ADO.NET Entity Framework to model entities. You need to create a database from your model. What should you do?

A.    Run the edmgen.exe tool in FullGeneration mode.
B.    Run the edmgen.exe tool in FromSSDLGeneration mode.
C.    Use the Update Model Wizard in Visual Studio.
D.    Use the Generate Database Wizard in Visual Studio. Run the resulting script against a Microsoft SQL Server database.

Answer: D
Explanation:
To update the database, right-click the Entity Framework designer surface and choose Generate Database From Model. The Generate Database Wizard produces a SQL script file that you can edit and execute.


http://www.passleader.com/70-516.html