Microsoft TS: Windows Communication Foundation velopment with Microsoft .NET Framework 4 Sample Questions:
1. A Windows Communication Foundation (WCF) client configuration file contains the following XML segment in the system.serviceModel element.
<client>
<endpoint address=" net.tcp://server/ContosoService "
binding=" netTcpBinding "
contract=" Contoso. IContoso Service "
name=" netTcp " / >
<endpoint address=" net.pipe://localhost/ContosoService "
binding=" netNamedPipeBinding "
contract=" Contoso. IContoso Service "
name=" netPipe " />
</client>
You need to create a channel factory that can send messages to the endpoint listening at net.pipe://localhost/ContosoService.
Which code segment should you use
A) Dim factory As ChannelFactory (Of Contoso. IContosoService ) =
New ChannelFactory (Of Contoso. IContosoService )(" Contoso. IContosoService ")
B) Dim factory As ChannelFactory (Of Contoso. IContosoService ) =
New ChannelFactory (Of Contoso. IContosoService )(" netPipe ")
C) Dim factory As ChannelFactory (Of Contoso. IContosoService ) =
New ChannelFactory (Of Contoso. IContosoService )(
" net.pipe://localhost/ContosoService ")
D) Dim factory As ChannelFactory (Of Contoso. IContosoService ) =
New ChannelFactory (Of Contoso. IContosoService )(" netNamedPipeBinding ")
2. You are consuming a Windows Communication Foundation (WCF) service. The service interface is defined as follows.
[DataContract(Namespace = "")]
public class Item
{
...
}
[ServiceContract(Namespace = "")]
public interface ICatalog
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/Item")]
Item UpdateItem(Item item);
}
The client application receives a WebResponse named response with the response from the service.
You need to deserialize this response into a strongly typed object representing the return value of the method.
Which code segment should you use?
A) DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(Item));
Item item = s.ReadObject(response.GetResponseStream()) as Item;
B) DataContractSerializer s = new DataContractSerializer(typeof(Item));
Item item = s.ReadObject(r) as Item;
C) Item item = f.Deserialize(response.GetResponseStream()) as Item;
XmlDictionaryReader r = JsonReaderWriterFactory.CreateJsonReader(
response.GetResponseStream(),
XmlDictionaryReaderQuotas.Max);
D) DataContractSerializer s = new DataContractSerializer(typeof(Item));
Item item = s.ReadObject(response.GetResponseStream()) as Item;
BinaryFormatter f = new BinaryFormatter();
3. You are developing a Windows Communication Foundation (WCF) service. The following code defines and implements the service. (Line numbers are included for reference only.)
You need to ensure that two identical copies of the received message are created in the service.
Which code segment should you insert at line 12?
A) Message msgCopy = message.
CreateBufferedCopy(8192) as Message;
Message returnMsg = message.
CreateBufferedCopy(8192) as Message;
B) MessageBuffer buffer = message.
CreateBufferedCopy(8192);
Message msgCopy = buffer.CreateMessage();
Message returnMsg = msgCopy;
C) Message msgCopy = message;
Message returnMsg = message;
D) MessageBuffer buffer = message.
CreateBufferedCopy(8192);
Message msgCopy = buffer.CreateMessage();
Message returnMsg = buffer.CreateMessage();
4. You are developing a Windows Communication Foundation (WCF) service. One of the parameters used with the service operations is a security token. The security token is not sensitive. The monitoring software tracks security tokens and can read tokens in clear text only.
The company security policy requires that you validate all clear text data passed over the corporate network.
You need to ensure that the service verifies that the security token is not changed during transit.
What should you do?
A) For all the security-sensitive members, set the ProtectionLevel parameter of the MessageBodyMember or MessageHeader attribute to EncryptAndSign.
B) For all the security-sensitive members, set the ProtectionLevel parameter of the MessageBodyMember or MessageHeader attribute to Sign.
C) Implement IEndpointldentityProvider in the message contract class.
D) Implement ISecureConversationSession in the message contract class.
5. You are creating a Windows Communication Foundation (WCF) service that responds using plain-old XML (POX).
You have the following requirements:
- You must enable the /catalog.svc/items operation to respond using the POX, JSON, or ATOM formats. You also must ensure that the same URL is used regardless of the result type.
- You must determine the response format by using the Accepts HTTP header.
What should you do?
A) Implement the System.Runtime.Serialization.IFormatterConverter interface in the service class.
B) Implement the IChannelInitializer interface in the service class.
C) Set the BodyStyle parameter of the WebGet attribute on the operation to WebMessageBodyStyle.WrappedResponse.
D) Set the return type of the operation to System.ServiceModel.Channels.Message. Use the current WebOperationContext methods to return the data in the required format.
Solutions:
| Question # 1 Answer: C | Question # 2 Answer: D | Question # 3 Answer: D | Question # 4 Answer: B | Question # 5 Answer: D |














1279 Customer Reviews
Quality and ValueITCertKing Practice Exams are written to the highest standards of technical accuracy, using only certified subject matter experts and published authors for development - no all study materials.
Tested and ApprovedWe are committed to the process of vendor and third party approvals. We believe professionals and executives alike deserve the confidence of quality coverage these authorizations provide.
Easy to PassIf you prepare for the exams using our ITCertKing testing engine, It is easy to succeed for all certifications in the first attempt. You don't have to deal with all dumps or any free torrent / rapidshare all stuff.
Try Before BuyITCertKing offers free demo of each product. You can check out the interface, question quality and usability of our practice exams before you decide to buy.
