Exam 70-513,516,515

Exam 70-513,516,515

BSS Internal

published on January 24, 2011
1/30

A Windows Communication Foundation (WCF) client uses the following service contract.
(Line numbers are included for reference only.)
01 [ServiceContract]
02 public interface IService
03 (
04 [OperationContractj
05 string Operation1O;
06 [OperationContract]
07 string Operation2(),
08)
You need to ensure that all calls to Operation 1 and Operation2 from the client are encrypted and signed What should you do?

Set the ProtectionLevel property in line 01 to EncryptAndSign
Set the ProtectionLevel property in line 04 and line 06 to Sign
Add a SecurityCriticalAttribute ror each operation
Add a SecunitySafeCriticalAttribute for each operation
2/30

Add a SecunitySafeCriticalAttribute for each operation

Hint: 1 choice
Add a MessageBodyMember attribute to the CodeName property and set the ProtectionLevel to Sign. Add a MessageBodyMember attribute to the Sec retHandshake pro...
Add a DataProtectionPermission attribute to the each property and set the ProtectData property to True
Add an XmlText attribute to the CodeName property and set the DataType property to Signed. Add a PasswordPropertyText attribute to the SecretHandshake proper...
Add an ImmutableObject attribute to the CodeName property and set its value property to True. Add a Browsable attribute to the SecretHandshake property and s...
3/30

Add an ImmutableObject attribute to the CodeName property and set its value property to True.
Add a Browsable attribute to the SecretHandshake property and set its value to False.

Hint: 1 choice
Add a DataProtectionPermission attribute to the CreditCardNumber property and set the ProtectData property to True.
Convert the DataContract to a MessageContract and set the ProtectionLevel property to SignAndEncrypt
Change the data type of CreditCardNumber from String to SecureString.
Implement the CreditCardNumber property getter and setter. In the setter, run the value of the CreditCardNumber through the MD5CryptoServiceProvider class Tr...
4/30

A Windows Communication Foundation (WCF) client application is consuming an RSS syndication feed from a blog.
You have a SyndicaionFeed variable named feed. The application iterates through the items as follows.
(Line numbers are included for reference only.)
01 foreach (Syndicationltem item in feed.ltems)
02 {
03 }
You need to display the content type and body of every syndication item to the console
Which two lines of code should ou insert between lines 02 and 03?

Hint: 1 choice
ConsoleWriteLine(tem. Content.Type); ConsoleWriteLine(((TextSyndicationContent)tem. Content).Text);
Console.WriteLine(tem. Content.GetType0); Console.WriteLine(((TextSyndic ationContent)tem. Content).Text);
Console.WriteLine(tem.Content.Type), Console.WriteLine(tem.Content.ToString0);)
Console.WriteLine(tem.Content.GetType0); Console.WriteLine(tem.Content.ToString0);)
5/30

A Windows Communication Foundation (WCF) application exposes a service as a SOAP end point for consumption by cross-platform dents’
During integration testing, you find that one of the clients is not generating the correct messages to the WCF application.
In order to debug the issue and fix the communication, you need to configure the senice to log messages received from the client
What should you do?

Hint: 1 choice
Set an etw Tracking behavior on the service and configure a listener for the System Service Model trace source
Set an etw Tracking behavior on the service and configure a listener for the System Service Model. Message Logging trace source.
Enable message Logging in the System Service Model diagnostics element configuration and configure a listener for the System Service Model Message Logging tr...
Enable message Logging in the System.Service Model diagnostics element configuration and configure a listener for the System. Service Model trace source.
6/30

A Windows Communication Foundation (WCF) solution exposes the following contract over an HTTP connection
<ServiceContractQ>
Public Interface IDataService <OperationContract0s?
Function GetData() As String End Interface Existing clients are making blocking calls to GetData
Calls to GetData take five seconds to complete
You need to allow new clients to issue non-blocking calls to get the data, without breaking any existing clients.
What should you do?

Hint: 1 choice
Replace the service interface with the following interface and implement the new methods. <ServiceContract0> Public Interface lDoSomething <OperationContract...
Replace the service interface with the following interface and implement the new methods. <ServiceContract0> Public Interface IDoSomething <OperationContract...
Generate a proxy class with asynchronous methods and use it for the new clients.
Add a new endpoint to the service that uses a full-duplex binding and use it for the new clients
7/30

You are creating a Windows Communication Foundation (WCF) service You have the following requirements.
“Messages must be sent over TCR
‘The service must support transactions.
“Messages must be encoded using a binary encoding
“Messages must be secured using Windows stream-based security. You need to implement a custom binding for the service
In which order should the binding stack be configured?

Hint: 1 choice
tc pTransport windowsStreamSec urity transactionFlow binaryMessageEnc oding
transactionFlow binaryMessageEnc oding windowsStreamSec urity tc pTransport
windowsStreamSec urity tc pTransport binaryMessageEnc oding transactionFlow
8/30

A Windows Communication Foundation (WCF) service uses the following service contract. [ServceContract]
public interface IService
{
[OperationContract]
string Operation 1 (stnng s);
}
You need to ensure that the operation contract Operationi responds to HTTP POST requests.
Which code segment should you use?

Hint: 1 choice
[OperationContract| [Weblnvoke(Method POST)] string Operationl(string s);
[OperationContract| [WebGet(UriTemplate = POST’)] string Operation 1 (string s);
[OperationContract(ReplyAction z ‘POST’)J string Operationi (string s);
[OperationContract(Action WPOST)1 string Operationl(string s);
9/30

You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner. You need to add a delete operation You implement the delete method as follows.
Sub Deleteltems(Byval id As String) You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation What should you do

Hint: 1 choice
Add the Weblnvoke(UriTemplatez’7ltems/(id}, Method:z”DELETE”) attribute to the operation.
Add the HttpDelete attribute to the operation.
Replace the string parameter with a RemovedActivityAction parameter
Change the Sub statement to Function and specify RemovedActivityAction as the return type.
10/30

You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner
You need to add a delete operation
You implement the delete method as follows.
string oid Deleteltems(string id);
You need to configi.re WCF to ci this method when the client calls the service with the HTTP DRETE opera on
What should you do?

Hint: 1 choice
Add the Weblnvoke(UriTemplate = "/Items/(idy, Method=”DELETE") attribute to the operation
Add the HttpDelete tribute to the operation
Replace the stnng parameter with a RemovedActivityAction parameter
Replace the retumn type with RemovedActivityktion
11/30

You create a page in an ASP.NET Web application. The page retrieves and displays data from a Microsoft SQL Server database. You need to create a data source that can connect to the database. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Hint: 2 choices
Use an ObjectDataSource control and set its TypeName property to System.Data.SqlClient.SqlConnection.
Use a SqlDataSource control and configure its ConnectionString in the web.config file.
Use an XmlDataSource control together with an Xml control that represents the database.
Use a LinqDataSource control with entity classes that represent the elements in the database
12/30

You are implementing an ASP.NET page that will retrieve large sets of data from a data source. You add a ListView control and a DataPager control to the page. You need to ensure that the data can be viewed one page at a time. What should you do?

Hint: 1 choice
Set the DataPager control’s PageSize property to the number of rows to view at one time.
Set the DataPager control’s PagedControlID property to the ID of the ListView control
In the code–behind file, set the DataPager control’s Parent property to the ListView control
In the code–behind file, set the ListView control’s Parent property to the DataPager control
13/30

You are preparing to deploy an ASP.NET application to a production server by publishing the application in Release configuration. You need to ensure that the connection string value that is stored in the web.config file is updated to the production server’s connection string value during publishing. What should you do?

Hint: 1 choice
Add the following code to the web.config file. <connectionStrings> <add name="DB" connectionString="Server=ProdServer;Database=ProdDB;Integrated Security=SSP...
Add the following code to the web.config file. <connectionStrings> <add name="DB" connectionString="Server=ProdServer;Database=ProdDB;Integrated Security=SSP...
Add the following code to the web.release.config file. <connectionStrings> <add name="DB" connectionString="Server=ProdServer;Database=ProdDB;Integrated Secu...
Add the following code to the web.release.config file. <connectionStrings> <add name="DB" connectionString="Server=ProdServer;Database=ProdDB;Integrated Secu...
14/30

You use the ASP.NET Web Application template to create an application in a new Visual Studio solution. The project uses types that are defined in a class library project. Source code for the class library is frequently modified. You need to ensure that classes in the Web application project always reference the most recent version of the class library types. What should you do?

Hint: 1 choice
Add the class library project to the solution. Modify the class library project to add a reference to the Web application project.
Add the class library project to the solution. Modify the Web application project to add a reference to the class library project.
Add a post-build step to the Web application project that copies the most recent version of the class library assembly to the bin folder of the Web application
Add a post-build step to the class library project that copies the most recent version of the class library assembly to the App_Code folder of the Web applic...
15/30

You are creating an ASP.NET Web site. The site contains pages that are available to anonymous users.
The site also contains a page named Premium.aspx that provides premium content to only members of a group named Subscribers.
You need to modify the web.config file to ensure that Premium.aspx can be accessed by only members of the Subscribers group.
Which configuration should you use?

Hint: 1 choice
<location path="Premium.aspx"> <system.web> <authorization> <allow users="Subscribers"/> <deny users="*"/> </authorization> </system.web> </location>
<location path="Premium.aspx"> <system.web> <authorization> <allow roles="Subscribers"/> <deny users="*"/> </authorization> </system.web> </location>
<location path="Premium.aspx"> <system.web><authorization> <allow roles="Subscribers"/> <deny users="?"/> </authorization> </system.web> </location>
<location path="Premium.aspx"> <system.web> <authorization> <deny users="*"/> <allow roles="Subscribers"/> </authorization> </system.web> </location>
16/30

You are implementing an ASP.NET page. The page includes a method named GetCustomerOrderDataSet that returns a DataSet.
The DataSet includes a DataTable named CustomerDetailsTable and a DataTable named OrderDetailsTable.
You need to display the data in OrderDetailsTable in a DetailsView control named dtlView.
Which code segment should you use?

Hint: 1 choice
dtlView.DataSource = GetCustomerOrderDataSet() dtlView.DataMember = "OrderDetailsTable" dtlView.DataBind()
dtlView.DataSource = GetCustomerOrderDataSet() dtlView.DataSourceID = "OrderDetailsTable" dtlView.DataBind()
dtlView.DataSource = GetCustomerOrderDataSet() dtlView.DataKeyNames = New String() {"OrderDetailsTable"} dtlView.DataBind()
Dim dataSet As DataSet = GetCustomerOrderDataSet() dtlView.DataSource = New DataTable("dataSet", "OrderDetailsTable") dtlView.DataBind()
17/30

You deploy an ASP.NET application to an IIS server.
You need to log health-monitoring events with severity level of error to the
Windows application event log.
What should you do?

Hint: 1 choice
Run the aspnet_regiis.exe command.
Set the Treat warnings as errors option to All in the project properties and recompile
Add the following rule to the <healthMonitoring/> section of the web.config file. <rules> <add name="Failures" eventName="Failure Audits" provider="EventLogP...
Add the following rule to the <healthMonitoring/> section of the web.config file. <rules> <add name="Errors" eventName="All Errors" provider="EventLogProvide...
18/30

You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages.
You create a static method named SiteHelper.Configure that configures the component.
You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested.
Which code segment should you use?

Hint: 1 choice
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) SiteHelper.Configure() End Sub
Sub Application_Init(ByVal sender As Object, ByVal e As EventArgs) SiteHelper.Configure()End Sub
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) SiteHelper.Configure() End Sub
Dim lockObject As Object = New Object() Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) SyncLock (lockObject()) SiteHelper.Configu...
19/30

You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages.
You create a static method named SiteHelper.Configure that configures the component.
You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested.
Which code segment should you use?

Hint: 1 choice
void Application_Start(object sender, EventArgs e) { SiteHelper.Configure(); }
void Application_Init(object sender, EventArgs e) { SiteHelper.Configure(); }n
void Application_BeginRequest(object sender, EventArgs e) { SiteHelper.Configure(); }
Object lockObject = new Object(); void Application_BeginRequest(object sender, EventArgs e) { lock(lockObject()) { SiteHelper.Configure(); } }
20/30

You are implementing an ASP.NET Web site. The root directory of the site contains a page named Error.aspx.
You need to display the Error.aspx page if an unhandled error occurs on any page within the site.
You also must ensure that the original URL in the browser is not changed.
What should you do?

Hint: 1 choice
Add the following configuration to the web.config file. <system.web> <customErrors mode="On"> <error statusCode="500" redirect="~/Error.aspx" /> </customErro...
Add the following configuration to the web.config file. <system.web><customErrors redirectMode="ResponseRewrite" mode="On" defaultRedirect="~/Error.aspx" /> ...
Add the following code segment to the Global.asax file. void Application_Error(object sender, EventArgs e) { Response.Redirect("~/Error.aspx"); }
Add the following code segment to the Global.asax file. void Page_Error(object sender, EventArgs e) Server.Transfer("~/Error.aspx"); }
21/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Forms application. The application connects to a Microsoft SQL Server database.
You need to find out whether the application is explicitly closing or disposing SQL connections.
Which code segment should you use?

Hint: 1 choice
Dim instanceName As String = Assembly.GetEntryAssembly().FullName Dim perf As New PerformanceCounter( ".NET Data Provider for SqlServer", "NumberOfReclaimedC...
Dim leakedConnections As Integer = DirectCast(perf.NextValue(), Integer) Dim instanceName As String = Assembly.GetEntryAssembly().GetName().Name Dim perf As ...
Dim leakedConnections As Integer = DirectCast(perf.NextValue(), Integer) Dim instanceName As String = Assembly.GetEntryAssembly().FullName Dim perf As New Pe...
Dim leakedConnections As Integer = DirectCast(perf.NextValue(), Integer) Dim instanceName As String = Assembly.GetEntryAssembly().GetName().Name Dim perf As ...
22/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Forms application. The application connects to a Microsoft SQL Server database.
You need to find out whether the application is explicitly closing or disposing SQL connections.
Which code segment should you use?

Hint: 1 choice
string instanceName = Assembly.GetEntryAssembly().FullName; PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer", "NumberOfRe...
string instanceName = Assembly.GetEntryAssembly().GetName().Name; PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer", "Numb...
string instanceName = Assembly.GetEntryAssembly().FullName; PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer", "NumberOfNo...
string instanceName = Assembly.GetEntryAssembly().GetName().Name; PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer", "Numb...
23/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use the ADO.NET Entity
Framework to manage persistence-ignorant entities.
You create an ObjectContext instance named context. Then, you directly modify properties on several entities.
You need to save the modified entity values to the database.
Which code segment should you use?

Hint: 1 choice
context.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
context.SaveChanges(SaveOptions.DetectChangesBeforeSave);
context.SaveChanges(SaveOptions.None);
context.SaveChanges();
24/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database.
You load records from the Customers table into a DataSet object named dataset.
You need to retrieve the value of the City field from the first and last records in the Customers table.
Which code segment should you use?

Hint: 1 choice
Dim dt As DataTable = dataset.Tables("Customers") Dim first As String = dt.Rows(0)("City").ToString() Dim last As String = dt.Rows(dt.Rows.Count - 1)("City")...
Dim dt As DataTable = dataset.Tables("Customers") Dim first As String = dt.Rows(0)("City").ToString() Dim last As String = dt.Rows(dt.Rows.Count)("City").ToS...
Dim relationFirst As DataRelation = dataset.Relations(0) Dim relationLast As DataRelation = dataset.Relations(dataset.Relations.Count - 1) Dim first As Strin...
Dim relationFirst As DataRelation = dataset.Relations(0) Dim relationLast As DataRelation = dataset.Relations(dataset.Relations.Count) Dim first As String = ...
25/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database.
You load records from the Customers table into a DataSet object named dataset.
You need to retrieve the value of the City field from the first and last records in the Customers table.
Which code segment should you use?

Hint: 1 choice
DataTable dt = dataset.Tables["Customers"]; string first = dt.Rows[0]["City"].ToString(); string last = dt.Rows[dt.Rows.Count - 1]["City"].ToString();
DataTable dt = dataset.Tables["Customers"]; string first = dt.Rows[0]["City"].ToString(); string last = dt.Rows[dt.Rows.Count]["City"].ToString();
DataRelation relationFirst = dataset.Relations[0]; DataRelation relationLast = dataset.Relations[dataset.Relations.Count - 1]; string first = relationFirst.c...
DataRelation relationFirst = dataset.Relations[0]; DataRelation relationLast = dataset.Relations[dataset.Relations.Count]; string first = relationFirst.child...
26/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Microsoft ASP.NET application. The application connects to a Microsoft SQL Server database.
The application is hosted on a Web server along with other applications.
You need to secure the transmission of data between the application and the database. You need to achieve this goal without affecting other applications.
What should you do?

Hint: 1 choice
Encrypt the connection string
Use encryption to store sensitive data in the database
Use Secure Sockets Layer (SSL) to establish connections to the database
Use Internet Protocol Security (IPSec) to secure the communication channel
27/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database.
The application stores encrypted credit card numbers in the database.
You need to ensure that credit card numbers can be extracted from the database.
Which cryptography provider should you use?

Hint: 1 choice
DSACryptoServiceProvider
AesCryptoServiceProvider
MD5CryptoServiceProvider
SHA1CryptoServiceProvider
28/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You use a TableAdapter object to load a DataTable object. The DataTable object is used as the data
source for a GridView control to display a table of customer information on a Web page.
You need to ensure that the application meets the following requirements:
"Load only new customer records each time the page refreshes.
"Preserve existing customer records.
What should you do?

Hint: 1 choice
"Set the ClearBeforeFill property of the TableAdapter to false. "Use the Fill method of the TableAdapter.
"Set the ClearBeforeFill property of the TableAdapter to false. "Use the GetData method of the TableAdapter to create a new DataTable
"Set the ClearBeforeFill property of the TableAdapter to true. "Use the Fill method of the TableAdapter to load additional customers.
"Set the ClearBeforeFill property of the TableAdapter to true. "Use the GetData method of the TableAdapter to create a new DataTable
29/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application.
The application updates several Microsoft SQL Server databases within a single transaction.
You need to ensure that after a resource failure, you can manage unresolved transactions.
What should you do?

Hint: 1 choice
Call the EnlistVolatile method of the Transaction class.
Call the EnlistDurable method of the Transaction class.
Call the Reenlist method of the TransactionManager class.
Call the RecoveryComplete method of the TransactionManager class
30/30

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You use the ADO.NET Entity Data Model (EDM) to define a Customer entity.
You need to add a new Customer to the data store without setting all the customer's properties.
What should you do?

Hint: 1 choice
Call the Create method of the Customer object.
Call the CreateObject method of the Customer object.
Override the Create method for the Customer object.
Override the SaveChanges method for the Customer object