PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use to replace the existing code segment?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.
The service contains the following code segment.

[ServiceContract]
public interface IMathSrvc
{
[OperationContract]
void AddNumbers(int num);
[OperationContract]
int Clear();
}

You need to ensure that the service meets the following requirements: The service can call the AddNumbers operation multiple times
The AddNumbers operation must start a session on the initial call. The service must call the Clear operation only if a session exists.
The service must not call other operations after it calls the Clear operation.
Which code segment should you use to replace the existing code segment?

PrepAway - Latest Free Exam Questions & Answers

A.
[ServiceContract]
public interface IMathSrvc
{
[OperationContract(IsOneWay=true)]
void AddNumbers(int num);
[OperationContract(IsTerminating=true)]
int Clear();
}

B.
[ServiceContract]
public interface IMathSrvc
{
[OperationContract(IsTerminating=false)]
void AddNumbers(int num);
[OperationContract(IsTerminating=true)]
int Clear();
}

C.
[ServiceContract]
public interface IMathSrvc
{
[OperationContract(IsInitiating=true, IsOneWay=true)]
void AddNumbers(int num);
[OperationContract(IsTerminating=true)]
int Clear();
}

D.
[ServiceContract]
public interface IMathSrvc
{
[OperationContract]
void AddNumbers(int num);
[OperationContract(IsInitiating=false, IsTerminating=true)]
int Clear();
}


Leave a Reply