70-513 exam

16
C C CE E E R R R T T T M M M A A A G G G I I I C C C Demo Edition TS: Windows Communication Foundation Development with Microsoft .NET Framework 4 Exam: 70-513 70-513 1 http://www.certmagic.com

Upload: nazia-perveen

Post on 11-Mar-2016

245 views

Category:

Documents


0 download

DESCRIPTION

CertMagic.com is a place where you can find various types of 70-513 exam certifications preparation material. CertMagic’s full range of study material for the 70-513 exam helps you to be prepared for the 70-513 exam fully and enter the exam centre with full confidence. We provide you easy, simple and updated study material. After preparing from the 70-513 material prepared by us we guarantee you that you will be a certified professional. We guarantee that with CertMagic 70-513 study material, you will pass the Certification exam.

TRANSCRIPT

Page 1: 70-513 Exam

CCCEEERRRTTT MMMAAAGGGIIICCC

Demo Edition

TS: Windows Communication Foundation Development with Microsoft .NET Framework 4

Exam: 70-513

70-513

1 http://www.certmagic.com

Page 2: 70-513 Exam

QUESTION: 1You are creating a Windows Communication Foundation (WCF) service that isimplemented as follows.(Line numbers are included for reference only.)01|ServiceContract]02[ServiceBehavior(includeExceptionDetàilslnFaults = true)103putiic class OrderService04{05[Operation Contract]06putiic void Submit Order(Order an Order)07{ O8try09{10...11)1 2catch(DivideByZeroExcepton ex)13{1415)16)17)You need to ensure that the stack trace details of the exception ae not included inthe error information sent to the client.What should you do?

A. Replace line 14 with the following line. throw:B. Replace line 14 with the following linethrow new FaultException<Order>(anOrder, ex.ToString(fl;C. After hne 05, add the following line.[FaultContract(typeof(FaukEception<Order>))JReplace line 14 with the following line throw ex;D. Alter hne 05, add the following line[FaultContract(typeof(FaultException<Order>))JReplace line 14 with the following line.throw new FaultException<Order>(anOrder, "Divide by zero exception”):

Answer: D

QUESTION: 2You ae creating a Windows Communication Foundation (WCF) service that isimplemented as folks.(Line numbers are included for reference only.)01 <ServiceContract0>?02<ServiceBehaior(lncludeExceptionDetailInFaults: Time)>03Public Class OrderService0405eCNperationCortracto>d

70-513

2 http://www.certmagic.com

Page 3: 70-513 Exam

O6Putdic Sub Submit Order(ByVal anOrder As Order)0708Try09.10Catch ex As D wide By Zero Exception1112End Try13End Sub141 5End ClassYou need to ensure that the sack trace details of the exception are not included inthe error information sent to the client. What should you do?

A. Replace line 11 with the following line. ThrowB. Replace line 11 with the following line.Throw New FaultException(C* Order)(anOrder, exToSthng0)dC. After line 05, add the following line.‘cFaultContract(GetType(FautException(Of Order)))>Replace line 11 with the following line. Throw exD. After mne 05, add the following line.<FaultContract(GetType(FaultException(CX Order)))>Replace line 11 with the following line.Throw New FaultException(CX Order)(anOrder, “Divide by zero exception”)

Answer: D

QUESTION: 3You are creating a windows Communication Foundation (WCF) service.You donot want to pose the internal implementation at the service layer You ned toexpose the following class as a service named Arithmetic the an operation namedSum public class Calculator { public int Add(int x, nty) {)}Which code segment should you use?

A. [ServiceContract(Namespace=”Arithmetic")Jpublic class Calculator{ [Operation Contract(Action”Sum)]m public int Add(int x, intt y){} }

70-513

3 http://www.certmagic.com

Page 4: 70-513 Exam

B. IServiceContract(ConfigurationName=”Arithmetic”)Jpublic class Calculator{IOperaion Contract(Action”Sum’)]m public nit Add(int x, int y)}}C. [ServiceContract(Namie=”Arithmetic")]public class Calculator([OperationContract(Namee"Sum)]public int Add(int x, lnt y)(}D. [ServiceContract(Namie=”Arithmtic”)] public class Calculator{ (OperationContract(ReplyAction"Sum”)] public int Add(int x, lit y)(

Answer: C

QUESTION: 4You are creating a Windows Communication Foundation (WCF) service You donot want to expose the internal implementation at the service layer You need toexpose the following class as a service named Arithmetic with an operation namedSpurn.Public Class CalculatorPublic Function Add(ByVal x As Integer, ByVal yAs Integer) As IntegerEnd FunctionEnd ClassWhich code segment should you use?

A. <ServceContract(Namespace: ‘Arithmetic")>Public Class Calculator<OperationContract(Action:z”Su.rn’)>?Public Function Add(ByVaI x As integer, ByVal yAs Integer) As IntegerEnd FunctionEnd ClassB. <ServiceContract(ConfigurationName:=”Arithmetic”)>Public Class Calculator <OperationContract(Action:z”Surm”)sPublic Function Add(ByVal x As integer, ByVal yAs Integer) As IntegerEnd FunctionEnd ClassC. <ServiceContract(Name: “Arithmetic")>Public Class Calculator

70-513

4 http://www.certmagic.com

Page 5: 70-513 Exam

<OperationContract(Name: “Sum’)>Public Function Add(ByVaI x As integer, ByVal yAs Integer) As IntegerD. <ServiceContract(Name: z’Arithmetic”)>Public Class Calculator <OperationContract(ReplyAction: “Sum”)>Public Function Add(ByVal x As Integer, ByVal y AsInteger) As IntegerEnd FunctionEnd Class

Answer: C

QUESTION: 5You are developing a data contract for a Windows Communication Foundation(WCF) service. The data in the data contract must participate in round trips. Strictschema validity is not required. You need to ensure that the contract is forward-compatible and allows new data members to be added to it. Which interface shouldyou implement in the data contract class?

A. lCommunicationObjectB. lExtension <T>C. lExtensibleObject <TsD. lExtensibleDataObject

Answer: D

QUESTION: 6You are developing a data contract for a Windows Communication Foundation(WCF) service.The data in the data contract must participate in round tnps Strictschema validity is not required You need to ensure that the contract is forward-compatible and allows new data members to be added to it Which interface shouldyou implement in the data contract class?

A. lCommunicationObiectB. lExtension(Of T)C. lExtensibleObyect(Or T)D. lExtensibleDataObject

Answer: D

70-513

5 http://www.certmagic.com

Page 6: 70-513 Exam

QUESTION: 7Windows Communication Foundation (WCF) application uses a data contract thathas several data members.You need the application to throw aSerializationException if any of the data members are not present when aserialized instance of the data contract is deserialized.What should you do?

A. Add the Known Type attribute to the data contract.Set a default value in each ofthe data member declarations.B. Add the Known Type attribute to the data contract.Set the Order property ofeach data member to unique integer value.C. Set the Emit Default Value property of each data member to false.D. Set the lsRequired property of each data member to true.

Answer: D

QUESTION: 8A Windows Communication Foundation (WCF) application uses the followingdata contract[DataContract]public class Person{[DataMember]public string firstName,[DataMember]public string lastName:[DataMember]public mnt age;[DataMember]public int ID;}You need to ensure that the following xML segment is generated when the datacontract is serialized. <Person><firstName xsi:nile”true’I><lastName xsi:nil-true"/><lD>999999999 <liD></Person>Which code segment should you use?

A. [DataMember| public string firstName;

70-513

6 http://www.certmagic.com

Page 7: 70-513 Exam

[DataMember]public string lastName;[DataMember(EmitDefaultValue true)) public nit age = 0;[DataMember(EmitDefaultvalue true)] public int ID 999999999;B. [DataMember(EmitDefaultvalue false)]public string firstName = null;[DataMember(EmitDefaultValue = false)]public string lastName = null;[DataMember(EmitDefaultValue = true)] public int age = -1:[DataMember(EmitDefaultValue false)] public nit ID 999999999C.I [DataMember(EmitDefaultValue = true)] public string firstName;[Datal\ilember(EmitDefaultValue true)] public string IastNarne;[DataMember(EmitDefaultValue = false)] public nmt age -t[DataMember(EmitDefaultValue false)] public nit ID = 999999999D. [DataIviember] public string firstName = null;[DatalViember] public string lastName = null;[DataMember(EmitDefaultValue = false)] public nit age = 0:[DataFvlember(EmitDefaultValue false)] public nit ID = 999999999;

Answer: D

QUESTION: 9A Windows Communication Foundation (WC9 application uses the following datacontract.<DataContractO>Public Class Person <DataMemberOsPublic firstName As String <DataMemberO>Public lastName As String <DataMemberO>Public age As Integer <DataMemberO>Public ID As Integer End Class You need to ensure that the following XMLsegment is generated when the data contract is serialized.<Person><firstName xsi:nilz’true”/><lastName xsi:nifr”true’/><ID>999999999 <lID><Person>Which code segment should you use?

A. <DataMember>Public firstName As String <DataMember>Public lastName As String <DataMember(EmitDefaultValue:=True)>Public age As Integer 0 <DataMember(EmitDefaultValue:=True)s

70-513

7 http://www.certmagic.com

Page 8: 70-513 Exam

Public ID As Integer = 999999999B. <DataMember(EmitDefaultValue:sFalse)>?Public firstName As String = Nothing <DataMemnber(EmitDefaultValue:zFalse)>Public lastName As String = Notling <DataMemmber(EmitDefaultValue:=True)>Public age As Integer = -1 <DataMember(EmtDefaultValue:sFalse)s>Public ID As Integer = 999999999C. <DataMember(EmitDefaultValue =True)>Public firstName As String <DataMember(EmitDefaultValuee:True)s>Public lastName As String <Dattlember(EmitDefauftValue:zfalse)>Public age As Integer = -1 <DataMember(EmtDefaultValue:=False)>Public ID As Integer = 999999999D. <DataMemberO> Public firstName As String = Nothing <D1aMemberO>Public lastName As String = Nothing <DataMember(EmitDefaultValue:zFalse)>Public age As Integer =0 <DataMember (EmitDefautfValueaFaIse)> Putiic ID AsInteger = 999999999

Answer: D

QUESTION: 10The following is an example of a SOAP envelope.<s:Enelope xmlns:se’http://schemas.xmlsoporg/soap/envelopef’><s: Header> <h:Storeld xmlns:he"http:/!www.contoso.com”s 6495<Ih: Storeld></s:Header><s:Body><CheckStockRequest xmlnsehttp://wwwcorIosocom”><ltemld>2469 <Iltenld>4</CheckStoc kRequest><Is: Body><Is: Envelope>You need to create a message contract that generates the SOAP envelope.1 which code segment should you use?

A. [MessageContract(WrapperName=”http:I/www. contoso. comn”)]public class CheckStockRequest {[MessageHeader(Nanez"http:llwww.contoso.com”)] public mnt Storeld{get; set.}[MessageBodyMember(Namee’intp://www..contoso.com”)] public nit itemld{getset;)}B. [MessageContract(WrapperNamespace="http:I/www.contoso. comn”)]

70-513

8 http://www.certmagic.com

Page 9: 70-513 Exam

public class CheckStoc kRequest{[MessageHeader(Namespaces"http:I/www.contosocom”)]opublic nmt Storeld{get; set;)[MessageBodyMember(Namespaces”http://www. contoso . comn”)]public nmt ltemld{get; set;}}C. [MessageContract(WrapperNamespace=”http://www. contosocom”)]pi±lic classCheckStockRequest{[MessageHeader(Na-mespacesttp://wwwcontoso. comn")]public mnt Storeld{get set.}public mnt ltemld{get: set;})D. (MessageContract(WrapperNamespace=”httpJ/www. contosoc om”)]piblic classCheckStockRequest{[MessageHeader(Namespace11tp:IIwww. contoso. comn")]public int Storeld{get set;}(MessageBodyMember]public int ltemmld(get set}}

Answer: B

QUESTION: 11The following is an example of a SOAP envelope<s:Enelope xmlns:sshttp Ilschemas xmlso org/soap/enveloper> <s: Header><h:Stoweld xmlns:hzmttp:/twww.contoso.com”>6495<!h: Storeld><Is: Header><s: Bodys<CheckStockRequet xmlns=”httpJIwww.contoso.comy><Itemlh2469 c/ttemmdd></CheckStockRequest><Is: Bodys<Is: Erwelope>You ned to create a message contract that generates the SOAP envelope Whichcode segment should you use?

70-513

9 http://www.certmagic.com

Page 10: 70-513 Exam

A. <MessageContract(WrapperName: =“http:IIwww.contoso.com)>Public Class CheckStockReque<MessageHeader(Name http://www.conto.comn’)>Public Property Storeld As Integer<MessageBodyMenter(Name: —Thttp://www.contoso.com’)>Public Property ltemld As IntegerEnd ClassB. <MessageContract(WrapperNamespace ThttpiIwww. c ortoso corn”)>Public Class CheckStockRequest<MessageHeader(Namespace:z”http:/Iwwwcontoso. comn’)>Public Property Storeld As Integer<MessageBodyMember(Namespace: ‘http Ilwwww c ontoso c om")>Public Property ltemld AsIntegerEnd ClassC. <MessageContract(WrapperNamespace: =http://www.cortoso.comn”)>Public Class CheckStockReque<MessageHeader(Namnespace. ‘http://www.contoso.comw)>Public Property Storeld As IntegerPublic Property Itemld As IntegerEnd ClassD. <MessageContract(WrapperNamespace: http://www.conoso.comn”)>Public ClassCheckStockRequest<MessageHeader(Namespace:z’http://www.contoso.comn”)>Public Property Storeld As Integer cMessageBodyMernber0>aPublic Property Itemld As IntegerEnd Class

Answer: B

QUESTION: 12You are developing a client that sends several types of SOP? messages to aWindows Communication Foundation (WCF) service method named PostDataPostData is currently defined as follows[OperaionContractj? void PostData(Order data);You need to modify PostData so that it can receive any SO6P message which codesegment should you use

A. [OperaionContract0sOneWay true, Action = ‘v’, ReplyAction voidPostData(Order data);

70-513

10 http://www.certmagic.com

Page 11: 70-513 Exam

B. (OperaionCoritract(1sOneWay = true, Action “v’, ReplyAction = “.‘)JaddPostData(BodyWriterdata);C. [OperaionContractJ void PostDaa(BodyWnter data);D. [OperaionContract] void PostDaa(Message data);

Answer: D

QUESTION: 13You are developing a client that sends several types of SOAP messages to aWindows Communication Foundation (WCF) service method named PostDataPostData is currently defined as folIows<OperahonContracto>Sub PostData(Byval data As Order) You need to modify PostData so that it canreceive any SOAP message.Which code segment should you use?

A. <OperationContract(lsOneWay True, Action ReplyAction ‘-)> SubPostData(ByVal data As Order)B. eOperationContract(lsOneway: zTrue, Action:z’-’, ReplyAction: z"-’)> SubPostData(ByVal data As BodyWriter)C. <OperationContractO> Sub PostData(Byval data As BodyWriter)D. <OperationContract0> Sub PostData(ByVal data As Message)

Answer: D

QUESTION: 14A class named TestService implements the following interface.[ServiceContract]public interface lTestService {[OperationContract] DateTime GetServiceTimeo;}TestService is hosted in an ASP.NET application.You need to modify theapplication to allow the GetServiceTime method to return the data formatted asJSON. It must do this only when the request URL ends in /ServiceTime.Whatshould you do?

A. Add this attribute to the GetServiceTime method.[Weblnvoke(Methode”POSl”)]In the web.config file, add this element tosystem.serviceModel/behaviors/endpointBehaviors.<behavior namee"Json”>c

70-513

11 http://www.certmagic.com

Page 12: 70-513 Exam

<enableWebScript I></behavior>In the web.config file, configure TestService in the system.serviceModel/servicescollection as follows<service namez’TestService”><endpoint addresse"/ServiceTime” contracts”TestService”rbehaviorConfigurationz”Uson” bindingz”webHttpBinding” I></service>B. Add this attribute to the GetServiceTime method.[Weblnvoke(Method = “GET’, UriTemplate "/ServiceTime”,ResponseFormat = WebMessageFormat.Json)]In the web.config file, configure TestService in the system.serviceModel/servicescollection as follows.<service namez”TestService"><endpoint address="/ServiceTime” contract=”TestService”bindinge”webHttpBinding”!s?</service>C. Add this attribute to the GetServiceTime method[VVebGet(ResponseFormat= WebMessageFormatJson, UriTemplatee"/ServiceTime”)]Create a new svc file named Jsonversion.svc with the following content. <%@ServiceHostServicee"TestService’Factorye”SystemServiceModeLActivationWebServiceHostFactory" %>D. Add this attribute to the GetServiceTime method.[WebGet(UriTemplate = {Uson)/ServiceTime”)]Create a new .svc file named Jsonversion svc with the following content <%aServiceHostServicee”TestService”eFactory=”System ServiceModel.ActivationWebServiceHostFactory" %>

Answer: C

QUESTION: 15A class named TeaService implements the following interface<ServceContract0>?Public Interface lTestService<OperationContractO>Function GetServiceTime() As DateTimeEnd InterfaceTestService is hosted in an ASP.NET applicator.

70-513

12 http://www.certmagic.com

Page 13: 70-513 Exam

You need to modify the application to allow the GetServiceTime method to retumnthe data formatted as JSON.It must do this only wten the request URL ends inlServiceTime. What should you do?

A. Add this attnbute to the GetServiceTime method <webhvoke(Methodt“POST)>In the bconfig file, add this element tosystemserviceModeI/behaviors/endpointBehaviors.<behavior names”Json”>e<enabeeWebScript c/behavior>In the web.conflg file, configure TestService in the system.serviceModel/servicescollection as follows. <service namee"TestService”>s<endpoint addresseo/ServiceTime” contract-”TestSerAce””behaviorConlfgurationz’Json bindinge”webHttpBinding”!> <!servicesB. Add ths attrbute to the GetServiceTime method<Webhvoke(Method PGETw,UrTemplate:eiSeneiceTim&, ResponseFormat: WebMessageFormatJson)>In the bconfIg file, configure TestService in the system.arviceModeI/servicescollection as follows.<senvice namee"TestService”> <endpoint ad&esse"ISer,iceTime”rcontracte"TestSence’ bindingewebHttpBindngw />c/service>C. Add this attribute to the GetServiceTime method<webGet(ResponseFormat WebMessageFormatJson, UnTemplate:eJServiceTime")>?Create a new svc file named Jsonversion svc with the following contract <%@ServiceHostServicee"TessService”iFactory="System ServiceModelktivation WebServiceHosFactory" %sD. Add this attribute to the GetServiceTime method<WebGet(UriTempbte: z”{Json}/ServiceTime”)>Create a new svc file named Jsonversionsvc with the following contert <%@ServiceHostService=”TestSenvice”Factoryz’System Se viceMode[ktivationWebServiceHodFactory" %>

Answer: C

QUESTION: 16You are creating a Windows Communication Foundation (WCF) service thatimplements operations in a RESTful manner.You need to add a deleteoperation.You implement the delete method as follows.

70-513

13 http://www.certmagic.com

Page 14: 70-513 Exam

string oid Deleteltems(string id);You need to configi.re WCF to ci this method when the client calls the servicewith the HTTP DRETE opera on.What should you do?

A. Add the Weblnvoke(UriTemplate = "/Items/(idy, Method=”DELETE") attributeto the operationB. Add the HttpDelete tribute to the operationC. Replace the stnng parameter with a RemovedActivityAction parameterD. Replace the retumn type with RemovedActivityktion.

Answer: A

QUESTION: 17You are creating a Windows Communication Foundation (WCF) service thatimplements operations in a RESTful manner. You need to add a delete operationYou 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 servicewith the HTTP DELETE operation What should you do?

A. Add the Weblnvoke(UriTemplatez’7ltems/(id}, Method:z”DELETE”) attributeto the operation.B. Add the HttpDelete attribute to the operation.C. Replace the string parameter with a RemovedActivityAction parameterD. Change the Sub statement to Function and specify RemovedActivityAction asthe return type.

Answer: A

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

70-513

14 http://www.certmagic.com

Page 15: 70-513 Exam

A. [OperationContract| [Weblnvoke(Method POST)]string Operationl(string s);B. [OperationContract| [WebGet(UriTemplate = POST’)]string Operation 1 (string s);C. [OperationContract(ReplyAction z ‘POST’)Jstring Operationi (string s);D. [OperationContract(Action WPOST)1string Operationl(string s);

Answer: A

QUESTION: 19A Windows Communication Foundation (WCF) service uses the following servicecontract.<ServiceContracto>Public Interface IService <OperationContract0>? Function Operation 1 (RyVal sAs String) As StringEnd InterfaceYou need to ensure that the operation contract Operation 1 responds to HTTPPOST requests.Which code segment should you use?

A. <OperationContract0> <Weblnvoke(Method:z’POST”)> Function Operation 1(ByVal s As String) As StringB. <OperationContract0> <WebGet(UriTemplate: “POST’)> Function Operation 1(ByVal s As String) As StringC. <OperationContract(ReplyAction: ‘POST")> Function Operation 1 (ByVal s AsString) As StringD. <OperationContract(Action:z”POST”)> Function Operation 1 (ByVal s AsString) As String

Answer: A

QUESTION: 20A Windows Communication Foundation (WCF) service implements a contractwith one-way and request-reply operations.The service is exposed over a TCPtransport.Clients use a router to communicate with the service. The router isimplemented as follows.(Line numbers are included for reference only.)01 ServiceHost host = new ServiceHost(typeof(RoutingService));

70-513

15 http://www.certmagic.com

Page 16: 70-513 Exam

02 host AddServiceEndpoint(03 typeof(lSimplexDatagramRouter),04 new NetTcpBinding0, “net.tcp:/flocalhostlRouter”05);06 List <ServiceEndpoints lep new List <ServiceEndpoint>0;t07 lep.Add(08 new ServiceEndpoint(09 ContractDescription.GetContract(10 typeof(lSimplexDatagramRouter)11),12 new NetTcpBinding0,13 new EndpointAddress|’nettcp://localhost: 8080/Logger”)14)15);16 RoutingConfiguration rc new RoutingConfigurationO;17 rc. FilterTable.Add(new MatchAilMessageFilterO, lep);18 host. Description. Behaviors.Add(new RoutingBehavior(rc));Request-reply operations are failing.You need to ensure that the router can handleone-way and request-reply operations. What should you do?

A. Change line 03 as follows. typeof(l RequestReplyRouter),B. Change line 03 as follows. typeof(lDuplexSessionRouter),C. Change line 10 as follows. typeof(lRequestReplyRouter)D. Change line 10 as follows. typeof(lDuplexSessionRouter)

Answer: B

70-513

16 http://www.certmagic.com