PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

What should you do?

A Windows Communication Foundation (WCF) solution exposes the following contract over an HTTP connection.

[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?

What are two possible ways to achieve this goal?

A Windows Communication Foundation (WCF) solution uses the following contracts.
(Line numbers are included for reference only.)

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

When the client calls GetMessage on the service interface, 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 = new InstanceContext(new NameService(“client”));
23 …
24 …
25 DuplexChannelFactory<IGreetingService> factory = new DuplexChannelFactory<IGreetingService>(typeof(NameService), binding, address);
26 IGreetingService greetingService = factory.CreateChannel();

You need to ensure that the service 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.)

What should you do ?

You are developing a user control for Windows Presentation Foundation (WPF) application.

The user control contains a button. Both the user control and the hosting control must receive the button click event.

You need to ensure that the user control responsd to the button click event before hosting control responds to the event.

What should you do ?

Which code segment should you use?

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.IContosoService”
name=”netTcp”/>
<endpoint address=”net.pipe://localhost/ContosoService”
binding=”netNamedPipeBinding”
contract=”Contoso.IContosoService”
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?

Which markup segment should you insert at line 05 ?

You are developing a Windows Presentation Foundation (WPF) application that display pricing and inventory.

List box’s ItemsSource property has decimal and string types. Decimals represent price and strings represents the folowing markup is defined as follows.

<Window xmlns:clr=”clr-namespace:System;assembly=mscorlib”>
<ListBox ItemsSource=”{Binding}”>
<ListBox.Resources>

</ListBox.Resources>
</ListBox>
</Window>

You need to ensure that data templates are used to format the strings without changes and the decimals as ..

Which markup segment should you insert at line 05 ?