You are on page 1of 11

Microsof

70-513

Exam Name:
TS:Windows Communicaton Found Dev w/MS .NET Frmwk (C# and
VB) 4

Questons & Answers


(Demo Version Limited Content)

Thank you for Downloading 70-513 exam PDF Demo


You can also try our 70-513 practce exam sofware

Download Free Demo:


https://www.certificationsdesk.com/Microsoft/real-70-513-exam-questions.html
Queston: 1

You are creatng a Window s Communicaton Foundaton (WCF) service applicatonn The applicaton
needs to service many clients and requests simultaneouslyn The applicaton also needs to ensure
subsequent individual client requests provide a stateful conversatonn You need to confgure the
service to support these requirementsn Which atribute should you add to the class that is
implementng the service?

An [ ServiceBehavior ( InstanceContextMode =
InstanceContextModenPerSession,
ConcurrencyMode = ConcurrencyModenSingle )]
Bn [ ServiceBehavior ( InstanceContextMode =
InstanceContextModenPerCall,
ConcurrencyMode = ConcurrencyModenReentrant )]
Cn [ ServiceBehavior ( InstanceContextMode =
InstanceContextModenPerSession,
ConcurrencyMode = ConcurrencyModenMultple )]
Dn [ ServiceBehavior ( InstanceContextMode =
InstanceContextModenPerCall,
ConcurrencyMode = ConcurrencyModenMultple )]

Answer: C

Queston: 2

A service implements the following contractn (Line numbers are included for reference onlyn)

The service is implemented as followsn

ContosoService uses NetMsmqBinding to listen for messagesn The queue was set up to use
transactons for adding and removing messagesn You need to ensure that OperatonOne and
OperatonTwo execute under the same transacton context when they are invoked in the same
sessionn What should you do?

An Insert the following atribute to OperatonOne on IContosoServicen


[TransactonFlow(TransactonFlowOptonnMandatory)]
Insert the following atribute to OperatonTwo on IContosoServicen

Page | 2
[TransactonFlow(TransactonFlowOptonnMandatory)]
Bn Insert the following atribute to OperatonOne on ContosoServicen
[OperatonBehavior(TransactonScopeRequired = true,
TransactonAutoComplete = false)]
Insert the following atribute to OperatonTwo on ContosoServicen
[OperatonBehavior(TransactonScopeRequired = true,
TransactonAutoComplete = true)]
Cn Add the following XML segment to the applicaton confg fle in the systemnserviceModel/bindings
confguraton sectonn
<netMsmqBinding>
<binding name="contosoTx" durable="true" receiveContextEnabled="true" />
</netMsmqBinding>
Then use the NetMsmqBinding named contosoTx to listen for messages from the clientsn
Dn Add the following XML segment to the applicaton confg fle in the systemnserviceModel/bindings
confguraton sectonn
<customBinding>
<binding name="contosoTx">
<transactonFlow />
<binaryMessageEncoding />
<msmqTransport durable="true" />
</binding>
</customBinding>
Then use the CustomBinding named contosoTx to listen for messages from the clientsn

Answer: B

Queston: 3

A Windows Communicaton Foundaton (WCF) soluton exposes the following service over a TCP
bindingn (Line numbers are included for reference onlyn)
01 [ServiceContract]
02 [ServiceBehavior(ConcurrencyMode = ConcurrencyModenMultple)]
03 public class DataAccessService
04 {
05 [OperatonContract]
06 public void PutMessage(string message)
07 {
08 MessageDatabasenPutMessage(message);
09 }
10 [OperatonContract]
11 public string[] SearchMessages(string search)
12 {
13 return MessageDatabasenSearchMessages(search);
14 }
15 }
MessageDatabase supports a limited number of concurrent executons of its methodsn
You need to change the service to allow up to the maximum number of executons of the methods of
MessageDatabasen This should be implemented without preventng customers from connectng to
the servicen
What should you do?

An Change the service behavior as followsn


[ServiceBehavior(ConcurrencyMode = ConcurrencyModenMultple,

Page | 3
InstanceContextMode = InstanceContextModenSingle)]
Bn Change the service behavior as followsn
[ServiceBehavior(ConcurrencyMode = ConcurrencyModenSingle,
InstanceContextMode = InstanceContextModenPerSession)]
Cn Add a throtling behavior to the service, and confgure the maxConcurrentCallsn
Dn Add a throtling behavior to the service, and confgure the maxConcurrentSessionsn

Answer: C

Queston: 4

You are developing a Windows Communicaton Foundaton (WCF) service that allows customers to
update fnancial dat
an The service contract is defned as followsn (Line numbers are included for reference onlyn)

You need to ensure that the service is invoked within a transactonn


What should you do?
An Replace line 01 with the following coden
[ServiceContract(
SessionMode = SessionModenNotAllowed)]
Bn Replace line 01 with the following coden
[ServiceContract( SessionMode = SessionModenRequired)]
Cn Insert the following code at line 08n
[ServiceBehavior(
TransactonAutoCompleteOnSessionClose = false)]
Dn Insert the following code at line 08n
[ServiceBehavior(
ReleaseServiceInstanceOnTransactonComplete = false)]

Answer: B

Queston: 5

Page | 4
You are developing a Windows Communicaton Foundaton (WCF) service that is hosted by a
Windows Forms applicatonn
The ServiceHost instance is created in the Form constructorn
You need to ensure that the service is not blocked while the UI thread is busyn
What should you do?

An Decorate the service implementaton class with the following line of coden
[ServiceBehavior(
UseSynchronizatonContext = false)]
Bn Decorate the service implementaton class with the following line of coden
[ServiceBehavior(
ConcurrencyMode = ConcurrencyModenMultple)]
Cn Call the Invoke method of the form and supply a delegaten
Dn Call the BeginInvoke method of the form and supply a delegaten

Answer: A

Queston: 6

You develop a Windows Communicaton Foundaton (WCF) service that employees use to access
bonus informatonn You defne the following service contractn (Line numbers are included for
reference onlyn)
01 [ServiceContract(SessionMode = SessionModenRequired)]
02 public interface IFinancialService
03 {
04 [OperatonContract]
05 string Login(int employeeID, string passwordHash);
06
07 [OperatonContract]
08 double GetBonus(int month);
09
10 [OperatonContract(IsTerminatng = true)]
11 void Logout();
12 }
Client applicatons can invoke methods without logging inn
You need to ensure that the client applicatons invoke Login before invoking any other methodn
You also need to ensure that client applicatons cannot consume the service afer invoking Logoutn
Which two actons should you perform? (Each correct answer presents part of the solutonn Choose
twon)

An Replace line 04 with the following coden


[OperatonContract(IsInitatng = false)]
Bn Replace line 04 with the following coden
[OperatonContract(IsInitatng = true, IsTerminatng = true)]
Cn Replace line 07 with the following coden
[OperatonContract(IsInitatng = false)]
Dn Replace line 10 with the following coden
[OperatonContract(IsInitatng = false,
IsTerminatng = true)]

Answer: C, D

Queston: 7

Page | 5
You develop a Windows Communicaton Foundaton (WCF) service that interacts with Microsof
Message Queuing (MSMQ)n
The service requires sessionsn You need to create a custom binding that enables messages sent to the
queue to be viewed when you are using a listener tooln
Which binding elements should you use?

An textMessageEncoding and msmqTransport in this order


Bn textMessageEncoding and msmqIntegratonTransport in this order
Cn msmqTransport and textMessageEncoding in this order
Dn msmqIntegratonTransport and textMessageEncoding in this order

Answer: A

Queston: 8

You are creatng a Windows Communicaton Foundaton (WCF) servicen The service endpoints
change frequentlyn
On the service, you add a new ServiceDiscoveryBehavior to the Behaviors collecton of the
ServiceHost Descripton propertyn
You need to ensure that client applicatons can communicate with the service and discover changes
to the service endpointsn
What should you do?

An Add a new ServiceDiscoveryBehavior to the Behaviors collecton in the client applicatonn


Bn Add a new AnnouncementClient to the Behaviors collecton in the client applicatonn
Cn Use the FindCriteria class and the UdpDiscoveryEndpoint class to set up the binding in the client
applicatonn
Dn Use the DiscoveryProxy class and the EndpointDiscoveryMetadata class to set up the binding in
the client applicatonn

Answer: C

Queston: 9

You are developing an applicaton to update a users social statusn You need to consume the service
using Windows Communicaton Foundaton (WCF)n
The client confguraton is as followsn
<systemnserviceModel>
<bindings>
<webHtpBinding>
<binding name="SocialConfg">
<security mode="TransportCredentalOnly">
<transport clientCredentalType="Basic"
realm="Social API" />
</security>
</binding>
</webHtpBinding>
</bindings>
<client>
<endpoint address="htp://contosoncom"
binding="webHtpBinding"
bindingConfguraton="SocialConfg"

Page | 6
contract="ISocialStatus"
name="SocialClient" />
</client>
</systemnserviceModel>
The service contract is defned as followsn
[ServiceContract] public interface ISocialStatus {
[OperatonContract]
[WebInvoke(UriTemplate =
"/statuses/updatenxml?status={text}")]
void UpdateStatus(string text);
}
Which code segment should you use to update the social status?

An using (WebChannelFactory<ISocialStatus> factory =


new WebChannelFactory<ISocialStatus>("SocialClient"))
{
factorynCredentalsnUserNamenUserName = usernName;
factorynCredentalsnUserNamenPassword = usernPassword;
ISocialStatus socialChannel = factorynCreateChannel();
socialChannelnUpdateStatus(newStatus);
}
Bn using (ChannelFactory<ISocialStatus> factory =
new WebChannelFactory<ISocialStatus>(typeof(ISocialStatus)))
{
factorynCredentalsnUserNamenUserName = usernName;
factorynCredentalsnUserNamenPassword = usernPassword;
ISocialStatus socialChannel = factorynCreateChannel();
socialChannelnUpdateStatus(newStatus);
}
Cn using (ChannelFactory<ISocialStatus> factory =
new ChannelFactory<ISocialStatus>("POST"))
{
factorynCredentalsnWindowsnClientCredentalnUserName =
usernName;
factorynCredentalsnWindowsnClientCredentalnSecurePasswordn
SetAt(0, ConvertnToChar(usernPassword) );
ISocialStatus socialChannel = factorynCreateChannel();
socialChannelnUpdateStatus(newStatus); }
Dn using (WebChannelFactory<ISocialStatus> factory =
new WebChannelFactory<ISocialStatus>(typeof(ISocialClient)))
{
factorynCredentalsnWindowsnClientCredentalnUserName =
usernName;
factorynCredentalsnWindowsnClientCredentalnSecurePasswordn
SetAt(0, ConvertnToChar(usernPassword) );
ISocialStatus socialChannel = factorynCreateChannel();
socialChannelnUpdateStatus(newStatus); }

Answer: A

Queston: 10

You are developing a client applicaton that uses the following code to consume a Windows

Page | 7
Communicaton Foundaton (WCF) servicen (Line numbers are included for reference onlyn)
01 BasicHtpBinding myBinding = new BasicHtpBinding();
02 EndpointAddress myEndpointAddress =
new EndpointAddress(
"htp://contosoncom/TaxServicensvc");
03
04 ITaxService client = channelFactorynCreateChannel();
05 string data = clientnGetData(1);
You need to consume the servicen
Which code segment should you insert at line 03?

An var channelFactory = new ChannelFactory<ITaxService>();


Bn var channelFactory = new ChannelFactory<ITaxService>(
myBinding);
Cn var channelFactory = new ChannelFactory<ITaxService>(
myBinding, myEndpointAddress);
Dn var channelFactory = new ChannelFactory<ITaxService>(
"htp://contosoncom/TaxServicensvc");

Answer: C

Queston: 11

You are developing a client applicaton that consumes a Windows Communicaton Foundaton (WCF)
servicen
You use the svcutlnexe utlity to create a proxy for the servicen
You use the svcutlnexe switches that generate asynchronous callsn GetFlight is a service operaton
that takes no parameters and returns a stringn The GetFlightCallback method must be called when
the service operaton returnsn
You create an instance of the client proxy with the following coden
var client = new TravelServiceClient();
You need to ensure that a callback is received when the GetFlight operaton is called asynchronouslyn
Which code segment should you use?

An clientnBeginGetFlight(GetFlightCallback, null);
clientnGetFlight();
Bn clientnGetFlight();
clientnBeginGetFlight(GetFlightCallback, null);
Cn clientnGetFlightCompleted +=
new EventHandler<GetFlightCompletedEventArgs>(
GetFlightCallback);
clientnGetFlightAsync();
Dn IAsyncResult asyncResult = clientnBeginGetFlight(
GetFlightCallback, client);
clientnEndGetFlight(asyncResult);

Answer: C

Queston: 12

A Windows Communicaton Foundaton (WCF) soluton uses the following contractsn (Line numbers
are included for reference onlyn)
01 [ServiceContract(CallbackContract = typeof(INameService))]

Page | 8
02 public interface IGreetngService
03 {
04 [OperatonContract]
05 string GetMessage();
06 }
07
08 [ServiceContract]
09 public interface INameService
10 {
11 [OperatonContract]
12 string GetName();
13 }
When the client calls GetMessage on the service interface, the service calls GetName on the client
callbackn In the client, the class NameService implements the callback contractn
The client channel is created as followsn
22 In stanceContext callbackContext =
new InstanceContext(new NameService("client"));
25 DuplexChannelFactory<IGreetngService> factory =
new DuplexChannelFactory<IGreetngService>(
typeof(NameService), binding, address);
26 IGreetngService greetngService = factorynCreateChannel();
You need to ensure that the service callback is processed by the instance of NameServicen
What are two possible ways to achieve this goal? (Each correct answer presents a complete solutonn
Choose twon)

An Change line 25 to the following code segmentn


DuplexChannelFactory<IGreetngService> factory =
new DuplexChannelFactory<IGreetngService>(
callbackContext, binding, address);
Bn Change line 26 to the following code segmentn
IGreetngService greetngService =
factorynCreateChannel(callbackContext);
Cn Add the following code segment afer line 26n
callbackContextnIncomingChannelsnAdd((IDuplexChannel)greetngService);
Dn Add the following code segment afer line 26n
callbackContextnOutgoingChannelsnAdd((IDuplexChannel)greetngService);

Answer: A, B

Queston: 13

A Windows Communicaton Foundaton (WCF) service has a callback contractn You are developing a
client applicaton that will call this servicen
You must ensure that the client applicaton can interact with the WCF servicen
What should you do?

An On the OperatonContractAtribute, set the AsyncPatern property value to truen


Bn On the OperatonContractAtribute, set the ReplyActon property value to the endpoint address of
the clientn
Cn On the client, create a proxy derived from DuplexClientBase<TChannel>n
Dn On the client, use GetCallbackChannel<T>n

Answer: C

Page | 9
Queston: 14

A Windows Communicaton Foundaton (WCF) client applicaton is consuming an RSS syndicaton


feed from a blogn You have a SyndicatonFeed variable named feedn The applicaton iterates through
the items as followsn (Line numbers are included for reference onlyn)
01 foreach (SyndicatonItem item in feednItems)
02 {
03 }
You need to display the content type and body of every syndicaton item to the consolen
Which two lines of code should you insert between lines 02 and 03?

An ConsolenWriteLine(itemnContentnType);
ConsolenWriteLine(((TextSyndicatonContent)itemnContent)nText);
Bn ConsolenWriteLine(itemnContentnGetType());
ConsolenWriteLine(((TextSyndicatonContent)itemnContent)nText);
Cn ConsolenWriteLine(itemnContentnType); ConsolenWriteLine(itemnContentnToString());
Dn ConsolenWriteLine(itemnContentnGetType()); ConsolenWriteLine(itemnContentnToString());

Answer: A

Queston: 15

You are creatng a Windows Communicaton Foundaton (WCF) servicen


You have the following requirements:
Messages must be sent over TCPn
The service must support transactonsn
Messages must be encoded using a binary encodingn
Messages must be secured using Windows stream-based securityn
You need to implement a custom binding for the servicen
In which order should the binding stack be confgured?

An tcpTransport
windowsStreamSecurity
transactonFlow
binaryMessageEncoding
Bn transactonFlow
binaryMessageEncoding
windowsStreamSecurity
tcpTransport
Cn windowsStreamSecurity
tcpTransport
binaryMessageEncoding
transactonFlow
Dn binaryMessageEncoding
transactonFlow
tcpTransport
windowsStreamSecurity

Answer: B

Page | 10
Thank You for trying 70-513 PDF Demo

Start Your 70-513 Preparation


Use Coupon 20OFF for extra 20% discount on the purchase of
Practice Test Software. Test your 70-513 preparation with actual
exam questions.

To try our 70-513 practce exam sofware visit link below

https://www.certificationsdesk.com/Microsoft/real-70-513-exam-questions.html

Page | 11

You might also like