All Free Pass4sure PDF & VCE 70-516 Exam Questions (151-160)

QUESTION 151
You are working with an ObjectContext object that targets the mainframe and another ObjectContext object that targets SQL Server. When it’s time to save the changes, you want all changes to be sent to the mainframe and to SQL Server as one transaction. How can you accomplish this?

A.    Just save both ObjectContext objects because they automatically join the same transaction.
B.    Save to the mainframe and use an if statement to verify that the changes were successful. If successful, save to SQL Server.
C.    Wrap the saving of both ObjectContext objects within a TransactionScope object that is implemented in a using statement in which the last line executes the Complete method on the TransactionScope class.
D.    Use a Boolean flag to indicate the success of each save, which will tell you whether the save was successful.

Answer: C

QUESTION 152
The URI to your WCF data service is http://www.northwind.com/DataServices.svc. What can you add to the end of the URI to retrieve only a list of Order entities for the Customer entity whose CustomerID is `BONAP’?

A.    /Customers(`BONAP’)?$expand=Orders
B.    /Customers?$filter=CustomerID eq `BONAP’&$expand=Orders
C.    /Customers/Orders?$filter=CustomerID eq `BONAP’
D.    /Customers(`BONAP’)/Orders

Answer: D

QUESTION 153
You are writing a WCF data service that will be included in a large project that has many other WCF data services. Your WCF data service will provide access to a SQL server using the Entity Framework. The EDMX file already exists in the project and is used by other services. One of the tables exposed by your service is the Contacts table, which contains the list of employees and the list of external contacts, which are denoted by the IsEmployee column that can be set to 1 or 0. You want to configure your WCF data service to return the external contacts whenever someone queries the Contacts entity set through WCF Data Services. What is the best way to solve this problem?

A.    Modify the Contacts entity set in the EDMX file.
B.    Add a stored procedure to SQL Server and modify the EDMX file to create a function import that you can call.
C.    Add a method to your WCF data service class and adorn the method with a QueryInterceptorAttribute of Contacts. In the method, provide the filter.
D.    Add a lazy loader to the WCF data service that will filter out the employees.

Answer: C

QUESTION 154
What must you use to capture an exception that might occur when you are sending changes to the database server?

A.    A using block.
B.    A try/catch block.
C.    A while statement.
D.    You can’t capture exceptions.

Answer: B

QUESTION 155
Which of the following are valid encryption algorithms that can be selected when encrypting the connection strings in your .config files? (Each correct answer presents a complete solution. Choose two.)

A.    DpapiProtectedConfigurationProvider
B.    RNGCryptoServiceProvider
C.    SHA256Managed
D.    RsaProtectedConfigurationProvider
E.    RijndaelManaged

Answer: AD

QUESTION 156
Which of the following is a valid symmetric encryption algorithm?

A.    RNGCryptoServiceProvider
B.    RNGCryptoServiceProvider
C.    SHA256Managed
D.    RijndaelManaged

Answer: D

QUESTION 157
You want to synchronize data between your local SQL Server Compact tables and SQL Server 2008. You want the synchronization to send changes to SQL Server 2008, and you want to receive changes from SQL Server 2008. Which setting must you assign to the SyncDirection property of your sync agent’s tables?

A.    SyncDirection.Bidirectional
B.    SyncDirection.UploadOnly
C.    SyncDirection.Snapshot
D.    SyncDirection.DownloadOnly

Answer: A

QUESTION 158
You are adding a process to the application. The process performs the following actions:
1.    Opens a ContosoEntities context object named context1.
2.    Loads a Part object into a variable named part1.
3.    Calls the Dispose() method on context1.
4.    Updates the data in part1.
5.    Updates the database by using a new ContosoEntities context object named context2.
You need to update the database with the changed data from part1. What should you do?

A.    Add the following code segment before calling SaveChanges() on context2:
context2.ApplyCurrentValues(“Parts”, part1);
B.    Add the following code segment before calling SaveChanges() on context2:
context2.Attach(part1);
context2.ApplyCurrentValues(“Parts”, part1);
C.    Add the following code segment before calling SaveChanges() on context2:
context2.Attach(part1);
context2.ObjectStateManager.ChangeObjectState(part1, System.Data.EntitySate.Modified);
D.    Add the following code segment before calling SaveChanges() on context2:
context2.ApplyOriginalValues(“Parts”, part1);

Answer: C

QUESTION 159
The application must provide a component part list for any product. The component part list must give the quantity of
each distinct part that is required to manufacture that product.
You need to create a LINQ expression that delivers a a result of type IEnumerable<Tuple<int,Part>> to meet the requirements.
Which expression should you use?

A.    IEnumerable<Tuple<int, Part>> result = part.Children
.Distinct()
.GroupBy(p => p)
.Select(g => Tuple.Create(g.Count(), g.Key));
B.    IEnumerable<Tuple<int, Part>> result = part.Descendants
.GroupBy(p => p)
.Select(g => Tuple.Create(g.Count(), g.Key));
C.    IEnumerable<Tuple<int, Part>> result = part.Descendants
.ToDictionary(c => c)
.Select(d => Tuple.Create(d.Value.Children.Count(), d.Key));
D.    IEnumerable<Tuple<int, Part>> result = part.Children
.GroupBy(p => p)
.Select(g => Tuple.Create(g.Count(), g.Key));
E.    IEnumerable<Tuple<int, Part>> result = part.Descendants
.Distinct()
.GroupBy(p => p)
.Select(g => Tuple.Create(g.Count(), g.Key));

Answer: B

QUESTION 160
You are developing a new feature that displays an auto-complete list to users as the type color names. You have an
existing ContosoEntities context object named contex.
To support the new feature you must develop code that will accept a string object named text containing a user’s
partial input and will query the Colors database table to retrieve all color names that begin with that input.
You need to create an Entity SQL (ESQL) query to meet the requirement.
The query must not be vulnerable to a SQL injection attack. Which code segment should you use?

A.    var parameter = new ObjectParameter(“text”, text + “%”);
var result = context.CreateQuery<string>(
“SELECT VALUE (c.Name) FROM Colors AS c WHERE c.Name LIKE ‘@text'”, parameter);
B.    var parameter = new ObjectParameter(“text”, text + “%”);
var result = context.CreateQuery<string>(
“SELECT VALUE (c.Name) FROM Colors AS c WHERE c.Name LIKE @text”, parameter);
C.    var parameter = new ObjectParameter(“text”, text + “%”);
var result = context.CreateQuery<string>(
“SELECT (c.Name) FROM Colors AS c WHERE c.Name LIKE @text”, parameter);
D.    var parameter = new ObjectParameter(“text”, HttpUtility.HtmlEncode(text) + “%”);
var result = context.CreateQuery<string>(
“SELECT (c.Name) FROM Colors AS c WHERE c.Name LIKE ‘@text’@, parameter);

Answer: B

All Free Pass4sure PDF & VCE 70-516 Exam Questions