News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

MCPD- Exam 70-513: Windows Communication Foundation Development with Microsoft .NET Framework 4

01 [ServiceContract(CallbackContract=typeof(INameService))]
02 public interface IGreetingService
03 {
04 [OperationContract]
05 string GetMessage();
06 }
07
08 [ServiceContract]
09 public intetface INameService
10 {
11 [OperationContract]
12 string GetName();
13 }

When the client calls GetMessage on the service intetface, the service calls GetName on the client callback. In the client, the class NameService implements the callback contract. The client channel is created as follows:

22 InstanceContext callbackContext =
22 new Instance Context(new NameService("client"));
23
24
25 DuplexChannelFactory  factory = new DuplexChannelFactory
(
typeof(NameService), binding, address);
26 IGreetingService greetingService = factory.CreateChannel();

You need to ensure that the senvice callback is processed by the instance of NameService. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

  1. Change line 25 to the following code segment:

    DuplexChannelFactory <IGreetingService> factory = new DuplexChannelFactory<IGreetingService>(callbackContext, binding, address);
  2. Change line 26 to the following code segment:

    IGreetingService greetingServicefactory = CreateChannel(callbackContext);
  3. Add the following code segment after line 26:

    callbackContextIncomingChannelsAdd((IDuplexChannel)greetingService)
  4. Add the following code segment after line 26:

    callbackContext.OutgoingChannels.Add((IDuplexChannel)greetingService)
Answer: Answer is a, b

[ServiceContract]
public interface IDataService
{
[OperationContract]
string GetData();
}

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?

  1. Replace the service interface with the following interface and implement the new methods

    [ServiceContract]
    public intetface IDoSomething
    {
    [OperationContract]
    string DoLongOperation();
    [OperationContract(AsyncPattern= true)]
    IAsyncResult BeginDoLongOperation();
    [OperationContract(AsyncPattern = true)]
    string EndDoLongOperation(lAsyncResult result);
    }
  2. Replace the service interface with the following interface and implement the new methods.

    [ServiceContract]
    public interface IDoSomething
    {
    [OperationContract(AsyncPattern=true)]
    IAsyncResult BeginDoLongOperation();
    [OperationContract(AsyncPattern=true)]
    string EndDoLongOperation(IAsyncResult result);
    }
  3. Generate a proxy class with asynchronous methods and use it for the new clients.

  4. Add a new endpoint to the service that uses a full-duplex binding and use it for the new clients.

Answer: Answer is c

01 [ServiceContract]
02 public interface IDataAccessService
03 {
04 [OperationContract]
05 void PutMessage(string message);06
07 [OperationContract]
08 [FaultContract(typeof(TimeoutFaultException))]
09 [FaultContract(typeof(FaultException))]
10 string SearchMessages(string search);
11 }

The implementation of the SearchMessages method throws TimeoutFaultException exceptions for database timeouts. The implementation of the SearchMessages method also throws an Exception for any other issue it encounters while processing the request. These exceptions are received on the client side as generic FaultException exceptions. You need to implement the error handling code for SearchMessages and create a new channel on the client only if the channel faults. What should you do?

  1. Catch and handle both TimeoutFaultException and FaultException.

  2. Catch both TimeoutFaultException and FaultException. Create a new channel in both cases.

  3. Catch and handle TimeoutFaultException. Catch FaultException and create a new channel.

  4. Catch and handle FaultException. Catch TimeoutFaultException and create a new channel.

Answer: Answer is c

[ServiceContract]
public interface ICatalog
{
[OperationContract]
[WebGet(UriTemplate="/Catalog/Items/{id}", ResponseFormat=WebMessageFormat.
Json)]
string RetrieveItemDescription(int id);
}

The service is hosted at Catalogsvc.

You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemld. Which code segment should you use?

  1. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemId) null, function (data) { }, javascript");
  2. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemId), null, function (data) { }, "json");
  3. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemld), null, function (data) { }, "xml");
  4. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemld), null, function (data) { }, "json");
Answer: Answer is b

[DataContract(Namespace = '']
public class Item
{
[ServiceContract(Namespace = '')]
public interface Catalog
{
[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?

  1. DataContractSerializer s = new DataContractSerializer(typeof(Item));
    Item item = s.ReadObject(response.GetResponseStream0) as ttem;
  2. BinaryFormatter f = new BinaryFormatter();
    Item item = f.Deserialize(response.GetResponseStream() as Item;
  3. XmlDictionaryReader r = JsonReaderWriterFactory.CreateJsonReader(response.GetResponseStream(), XmlDictionaryReaderQuotas.Max);
    DataContractSerializer s = new DataContractSerializer(typeof(Item));
    Item item s.ReadObject(r) as Item;
  4. DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(Item));
    Item item = s.ReadObject(response.GetResponseStream()) as Item;
Answer: Answer is a

  1. Set an ETW Tracking behavior on the service and configure a listener for the System.ServiceModel trace source.

  2. Set an ETW Tracking behavior on the service and configure a listener for the System.ServiceModel. MessageLogging trace source.

  3. Enable message Logging in the System.ServiceModel diagnostics element configuration and configure a listener for the System.ServiceModel.MessageLogging trace source.

  4. Enable message Logging in the System.ServiceModel diagnostics element configuration and configure a listener for the System.ServiceModel trace source.

Answer: Answer is c

  1. routing

  2. serviceDebug

  3. serviceSecurityAudit

  4. workflowUnhandledException

Answer: Answer is b

01 foreach (SyndicationItem item in feed.Items)
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?

  1. ConsoleWriteLine(item.Content.Type);
    ConsoleWriteLine(((TextSyndicationContent)item.Content).Text);
  2. Console.WriteLine(item.Content.GetType());
    Console.WriteLine(((TextSyndicationContent)item.Content).Text);
  3. Console.WriteLine(item.Content.Type);
    Console.WriteLine(item.Content.ToString());
  4. Console.WriteLine(item.Content.GetType());
    Console.WriteLine(item.Content.ToString());
Answer: Answer is a

[DataContract]
public class Order
{
[DataMember]
public string CardHolderName { get; set;}
[DataMember]
public string CreditCardNumber { get; set; }
}

You have the following requirements
-Enable the transmission of the contents of Order from the clients to the service.
-Ensure that the contents of CreditCardNumber are not sent across the network in clear text.
-Ensure that the contents of CreditCardNumber are accessible by the service to process the order.
You need to implement the service to meet these requirements. What should you do?

  1. Add a DataProtectionPermission attribute to the CreditCardNumber property and set the ProtectData property to true.

  2. Convert the DataContract to a MessageContract and set the ProtectionLevel property to SignAndEncrypt

  3. Change the data type of CreditCardNumber from string to SecureString

  4. Implement the CreditCardNumber property getter and setter In the setter, run the value of the CreditCardNumber through the MD5CryptoServiceProvider class TransformBlock method

Answer: Answer is b

[MessageContract]
public class Agent
{
public string CodeName { get; set: }
public string SecretHandshake { get; set; }
}

You have the following requirements:
-The CodeName property must be sent in clear text.
-The service must be able to verify that the property value was not changed after being sent by the client.
-The SecretHandshake property must not be sent in clear text and must be readable by the service.
What should you do?

  1. Add a MessageBodyMember attribute to the CodeName property and set the ProtectionLevel to Sign. Add a MessageBodyMember attribute to the SecretHandshake property and set the ProtectionLevel to EncryptAndSign.

  2. Add a DataProtectionPermission attribute to the each property and set the ProtectData property to true

  3. Add an xmlText attribute to the CodeName property and set the DataType property to Signed. Add a PasswordPropertyText attribute to the SecretHandshake property and set its value to true.

  4. 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.

Answer: Answer is a

Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;