Microsoft Exam Questions

What should be done in the code to correct this error so that the service will compile and run prope

You have been tasked with creating a WCF service for a hospital. This service will provide access
to patient data. You have written the following code:
using System;
using System.ServiceModel;
namespace MyHospital.PatientService
{
[ServiceContract(Namespace=”MyHospital.PatientService”)]
public interface IPatientService
{
[OperationContract]
void CheckOutPatient(int PatientID);
int FindPatientRecord(string LastName,stringFirstName);
int AddPatientRecord(string LastName,stringFirstName);
}
}
However, you are getting an error in the above code. What should be done in the code to correct
this error so that the service will compile and run properly?

A.
The IPatientService interface should be a class.

B.
The [OperationContract] attribute should be defined before the interface definition.

C.
The namespace syntax is incorrect. It should simply have Namespace=”PatientService”).

D.
The code should have the [OperationContract] attribute before each method, and not just
before the first method.

Explanation: