Microsoft TS: Windows Communication Foundation velopment with Microsoft .NET Framework 4 (70-513) Free Practice Test
Question 1
You develop a Windows Communication Foundation (WCF) service to generate reports. Client applications call the service to initiate report generation but do not wait for the reports to be generated. The service does not provide any status to the client applications.
The service class is defined as follows. (Line numbers are included for reference only.)

You need to ensure that client applications can initiate reports without waiting for status.
Which two actions should you perform (Each correct answer presents part of the solution. Choose two.)
The service class is defined as follows. (Line numbers are included for reference only.)

You need to ensure that client applications can initiate reports without waiting for status.
Which two actions should you perform (Each correct answer presents part of the solution. Choose two.)
Correct Answer: A,D
Question 2
You are developing a Windows Communication Foundation (WCF) service.
You need to enable security auditing for all events.
What should you do?
You need to enable security auditing for all events.
What should you do?
Correct Answer: A
Question 3
A Windows Communication Foundation (WCF) application exposes a service as a SOAP endpoint for consumption by cross-platform clients. 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 service to log messages received from the client.
What should you do?
In order to debug the issue and fix the communication, you need to configure the service to log messages received from the client.
What should you do?
Correct Answer: C
Question 4
You are configuring a routing service to call a target service. The routing service has no knowledge of the target service's data types other than the service contract.
The operation contract for all of the methods of the target service specifies IsOneWay=true.
You need to specify the endpoint information for the routing service.
What should you do?
The operation contract for all of the methods of the target service specifies IsOneWay=true.
You need to specify the endpoint information for the routing service.
What should you do?
Correct Answer: B
Question 5
You are developing a Windows Communication Foundation (WCF) service that contains the following code segment.
[ServiceContract ] public interface ICustomerService { & }
public class CustomerService : ICustomerService { & }
The service is self-hosted in a console application. Older client applications access the service at http://contoso.com:8080/CustomerService/V1. Newer client applications access the service at http://contoso.com:8080/CustomerService/V2.
You need to ensure that any client application can access the service at either address.
Which code segment should you use?
[ServiceContract ] public interface ICustomerService { & }
public class CustomerService : ICustomerService { & }
The service is self-hosted in a console application. Older client applications access the service at http://contoso.com:8080/CustomerService/V1. Newer client applications access the service at http://contoso.com:8080/CustomerService/V2.
You need to ensure that any client application can access the service at either address.
Which code segment should you use?
Correct Answer: A
Question 6
You are developing a Windows Communication Foundation (WCF) service. You enable message logging, trace listeners, activity propagation, and tracing on the trace sources.
You have the following code segment in the client application. (Line numbers are included for reference only.)

You encounter errors when your client application consumes the service.
You need to ensure that your client application can correlate tracing information with the
service.
Which code segment should you add at line 04?

You have the following code segment in the client application. (Line numbers are included for reference only.)

You encounter errors when your client application consumes the service.
You need to ensure that your client application can correlate tracing information with the
service.
Which code segment should you add at line 04?

Correct Answer: B
Question 7
You develop a Windows Communication Foundation (WCF) service. You enable all performance counters and run multiple calls to the service.
The service must isolate session data for each user.
You need to monitor the instancing behavior used in the service.
Which performance counter should you monitor?
The service must isolate session data for each user.
You need to monitor the instancing behavior used in the service.
Which performance counter should you monitor?
Correct Answer: C
Question 8
You are developing a Windows Communication Foundation (WCF) service to provide an in-memory cache. The following code is part of your solution. (Line numbers are included for reference only.)
01 02 Public Interface IlnMemoryCacheService 03 04 <OperationContract()> 05 Function GetCachedItem( ByVal key As String) As String 06 07 <OperationContract() > 08 Sub CacheItem( ByVal key As String, ByVal item As String) 09 10 End Interface 11 12 <ServiceBehavior( InstanceContextMode:=InstanceContextHode.Single)> 13 Public Class CacheService 14 Implements IlnHemoryCacheService 15 16 Dim cache As Hashtatale - New Hashtable)> 17 18 Public Function GetCachedItem( ByVal key As String) As String mplements IInHemoryCacheService.GetCachedltem 19 20 Return cache (key) .ToStrlng() 21 22 End Function
23 24 Public Sub Cacheltem( ByVal key As String, ByVal item As String) Implements ilnMemoryCacheService.Cacheltem Then 25 26 If (cache.Contains(key) 27 cache.Remove(key) 28 End If 29 30 cache.Add(key, item) 31 32 End Sub
34 End Class
Users report that the cache is getting updated with cache changes of other users. You need to ensure that each user's cache is maintained and isolated from other users.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
01 02 Public Interface IlnMemoryCacheService 03 04 <OperationContract()> 05 Function GetCachedItem( ByVal key As String) As String 06 07 <OperationContract() > 08 Sub CacheItem( ByVal key As String, ByVal item As String) 09 10 End Interface 11 12 <ServiceBehavior( InstanceContextMode:=InstanceContextHode.Single)> 13 Public Class CacheService 14 Implements IlnHemoryCacheService 15 16 Dim cache As Hashtatale - New Hashtable)> 17 18 Public Function GetCachedItem( ByVal key As String) As String mplements IInHemoryCacheService.GetCachedltem 19 20 Return cache (key) .ToStrlng() 21 22 End Function
23 24 Public Sub Cacheltem( ByVal key As String, ByVal item As String) Implements ilnMemoryCacheService.Cacheltem Then 25 26 If (cache.Contains(key) 27 cache.Remove(key) 28 End If 29 30 cache.Add(key, item) 31 32 End Sub
34 End Class
Users report that the cache is getting updated with cache changes of other users. You need to ensure that each user's cache is maintained and isolated from other users.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
Correct Answer: C,D
Question 9
A Windows Communication Foundation (WCF) solution exposes the following service over a TCP binding. (Line numbers are included for reference only.)
01 [ServiceContract]
02 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
03 public class DataAccessService
04 {
05 [OperationContract]
06 public void PutMessage(string message)
07 {
08 MessageDatabase.PutMessage(message);
09 }
10 [OperationContract]
11 public string[] SearchMessages(string search)
12 {
13 return MessageDatabase.SearchMessages(search);
14 }
15 }
MessageDatabase supports a limited number of concurrent executions of its methods.
You need to change the service to allow up to the maximum number of executions of the methods of MessageDatabase. This should be implemented without preventing customers from connecting to the service.
What should you do?
01 [ServiceContract]
02 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
03 public class DataAccessService
04 {
05 [OperationContract]
06 public void PutMessage(string message)
07 {
08 MessageDatabase.PutMessage(message);
09 }
10 [OperationContract]
11 public string[] SearchMessages(string search)
12 {
13 return MessageDatabase.SearchMessages(search);
14 }
15 }
MessageDatabase supports a limited number of concurrent executions of its methods.
You need to change the service to allow up to the maximum number of executions of the methods of MessageDatabase. This should be implemented without preventing customers from connecting to the service.
What should you do?
Correct Answer: A
Question 10
A Windows Communication Foundation (WCF) service implements the following cortract.
<ServiceContract0>? Public Interface lHeloServic e <operationContractQ> <WebGet(UriTempbte: ="helloname={name}")s Function SayHello(Byval name As String) As nng End Interface The implementation is as follows Public Class HelloService Implements IHelloService
Public Function SayHello(ByVal name As String) As String - Implements lHelloServiceSayHello
Retumn "Hello "& name
End Function
End Cesst
The service is self-hosted, and the hosting code is as follows.
Dim stHost As WebServiceHo = CreateHost()
svcHo Open()
Consde ReadLine()
svcHoaClose()
You need to implement CreateHost so that the service has a single endpoint hosted
http:/Ilocalhost8000/HeloService.
Which code segment should you use?
<ServiceContract0>? Public Interface lHeloServic e <operationContractQ> <WebGet(UriTempbte: ="helloname={name}")s Function SayHello(Byval name As String) As nng End Interface The implementation is as follows Public Class HelloService Implements IHelloService
Public Function SayHello(ByVal name As String) As String - Implements lHelloServiceSayHello
Retumn "Hello "& name
End Function
End Cesst
The service is self-hosted, and the hosting code is as follows.
Dim stHost As WebServiceHo = CreateHost()
svcHo Open()
Consde ReadLine()
svcHoaClose()
You need to implement CreateHost so that the service has a single endpoint hosted
http:/Ilocalhost8000/HeloService.
Which code segment should you use?
Correct Answer: D
Question 11
You are building a client for a Windows Communication Foundation (WCF) service. You need to create a proxy to consume this service which class should you use?
Correct Answer: A
Question 12
You have an existing Windows Communication Foundation (WCF) Web service.
The Web service is not responding to messages larger than 64 KB.
You need to ensure that the Web service can accept messages larger than 64 KB without
generating errors.
What should you do?
The Web service is not responding to messages larger than 64 KB.
You need to ensure that the Web service can accept messages larger than 64 KB without
generating errors.
What should you do?
Correct Answer: A
Question 13
--- -
You develop a Windows Communication Foundation (WCF) service. Many client applications will consume the service.
You have the following requirements:
You must enable client sessions on the service.
The service must support multi-threaded operations.
If a client application uses sessions, the lifetime of the service instance must be
scoped to the lifetime of the session.
If a client application does not use sessions, the lifetime of the service must be
scoped to the lifetime of a method cal
You need to configure the service.
What should you do? (Each correct answer presents part of the solution. Choose three.)
You develop a Windows Communication Foundation (WCF) service. Many client applications will consume the service.
You have the following requirements:
You must enable client sessions on the service.
The service must support multi-threaded operations.
If a client application uses sessions, the lifetime of the service instance must be
scoped to the lifetime of the session.
If a client application does not use sessions, the lifetime of the service must be
scoped to the lifetime of a method cal
You need to configure the service.
What should you do? (Each correct answer presents part of the solution. Choose three.)
Correct Answer: C,D,F
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).