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

Mcq Answers for WCF

01 ServiceHost host = new ServiceHost(typeof(RoutingService));
02 host.AddServiceEndpoint(
03 typeof(ISimplexDatagramRouter),
04 new NetTcpBinding(), "net.tcp://localhost/Router"
05 );
06 List  lep = new List ();
07 lep.Add(
08 new ServiceEndpoint(
09 ContractDescription.GetContract(
10 typeof(ISimplexDatagramRouter)
11 ),
12 new NetTcpBinding(),
13 new EndpointAddress("net.tcp://localhost:8080/Logger")
14 )
15 );
16 RoutingConfiguration rc = new RoutingConfiguration();
17 rc.FilterTable.Add(new MatchAllMessageFilter(), lep);
18 host.Description.Behaviors.Add(new RoutingBehavior(rc));

Request-reply operations are failing. You need to ensure that the router can handle one-way and request-reply operations. What should you do?

  1. Change line 03 as follows

  2. Change line 03 as follows.

  3. Change line 10 as follows:

  4. Change line 10 as follows:

Answer: Answer is b

public interface IMessageProcessor
void ProcessMessages();
public class MessageProcessor: IMessageProcessor
public void ProcessMessage();

SubmitOrder makes a call to another service. The ProcessMessage method does not perform as expected under a heavy load. You need to enable processing of multiple messages. New messages must only be processed when the ProcessMessage method is not processing requests, or when it is waiting for calls to SubmitOrder to return. Which attribute should you apply to the MessageProcessor class?

  1. CallbackBehavior (ConcurrencyMode=ConcurencyMode.Reentrant)
  2. CallbackBehavior (ConcurrencyMode=ConcurrencyMode.Multiple)
  3. ServiceBehavior (ConcurrencyMode=ConcurrencyMode.Reentrant)
  4. ServiceBehavior (ConcurrencyMode=ConcurrencyMode.Multiple)
Answer: Answer is c

<endpoint address="", binding="netTcpBinding", bindingConfiguraton="NetTcpBinding_IMyService", contract="ServiceReference1.IMyService" name="NetTcpBinding_IMyService"/>

The generated configuration does not provide enough information for the client to communicate with the server. You need to update the client so that it can communicate with the server. What should you do?

  1. In the client configuration, change the value of the address attribute to net.tcp:// MyService

  2. In the client configuration, change the value of the address attribute to net.tcp:// MyService listen=

  3. After instantiating the client and before invoking any service operation, add this line of code.

    client.EndpointBehaviors.Add(new EndpointDiscoveryBehavior(){ Enabled true });
  4. After instantiating the client and before invoking any service operation, add this line of code.

    client.Endpoint.Behaviors.Add(new Client ViaBehavior(new Uri(net.tcp://www.
Answer: Answer is d

01 static void Main(string[] args)
02 {
03 ServiceHost host;
05 host.Open();
06 Console.Read Line();
07 host.Close()
08 }

You need to create a ServiceHost instance and assign it to the host variable, You also need to instantiate the service host. Which line of code should you insert at line 04?

  1. host = new ServiceHost("MyApplication.DataAccessService");
  2. host = new ServiceHost("MyApplication.DataAccess");
  3. host = new ServiceHost(typeof(IDataAccess));
  4. host = new ServiceHost(typeof(DataAccessService));
Answer: Answer is d

public interface IHelloService
[OperationContract (WebGet(UriTemplate="hello?name={name}")]
string SayHello(string name);

The implementation is as follows

public class HelloService: IHelloService
public string SayHello(string name)
return "Hello " + name;

The service is self-hosted, and the hosting code is as follows

WebServiceHost svcHost = CreateHost();
Console. ReadLine();

You need to implement CreateHost so that the service has a single endpoint hosted at http://localhost:8000/HelloService. Which code segment should you use?

  1. WebServiceHost svcHost = new WebServiceHost(typeof(HelloService)); 
    svcHost.AddServiceEndpoint(typeof(IHelloService), new WebHttpBinding(WebHttpSecurityMode.None), "http://localhost:8000/HelloService");
    return svcHost;
  2. Uri baseAddress = new Uri("http://localhost:8000"); 
    WebServiceHost svcHost = new WebServiceHost(typeof(HelloService), baseAddress);
    svcHostAddServiceEndpoint(typeof(IHelloService), new WebHttpBinding(WebHttpSecurityMode.None), "HelloService");
    return svcHost;
  3. WebServiceHost svcHost = new WebServiceHost(new HelloService()); 
    svcHost.AddServiceEndpoint(typeof(IHelloService), new WebHttpBinding(WebHttpSecurityMode.None), "http://localhost:8000/HelloService");
    retumn svcHost;
  4. Uri baseAddress = new Uri("http //localhost 8000/"); 
    WebServiceHost svcHost = new WebServiceHost(new HelloService(), baseAddress); svcHost.AddServiceEndpoint(typeof(IHelloService), new WebHttpBinding(WebHttpSecurityMode.None), "HelloService");
    retumn svcHost;
Answer: Answer is d
Further Reading:

Eliminate A and C, because there is no overload for WebServiceHost constructor that takes only one argument. Choose D over B because of the need of a single endpoint. D provides a singleton instance.Useful resources, WebServiceHost Constructor, WebServiceHost.AddServiceEndpoint

  1. ChannelFactory <TChannel>

  2. ServiceHost

  3. ClientRuntime

  4. CommunicationObject

Answer: Answer is a

01 SampleServiceProxy proxy = new SampleServiceProxy();
02 try
03 {
04 proxy.Processlnvoice(invoice);
05 }
06 catch
07 {
08 if(proxy.State == CommunicationState.Faulted)
09 {
11 }
12 }
13 proxy.UpdateCustomer(customer);

You need to return proxy to a state in which it can successfully execute the call in line 13. Which code segment should you use at line 10?

  1. proxy.Close();
  2. proxy = new SampleServiceProxy();
  3. proxy.Abort();
  4. proxy.Open();
Answer: Answer is c

  1. On the OperationContractAttribute, set the AsyncPattern property value to true

  2. On the OperationContractAttribute, set the ReplyAction property value to the endpoint address of the client

  3. On the client, create a proxy derived from DuplexClientBase <TChannel>

  4. On the client, use GetCallbackChannel <T>.

Answer: Answer is c

-Messages must be sent over TCP
-The service must support transactions.
-Messages must be encoded using a binary encoding
-Messages must be secured using Windows stream-based security.

You need to implement a custom binding for the service.
In which order should the binding stack be configured?

  1. tcpTransport, windowsStreamSecurity, transactionFlow, binaryMessageEncoding

  2. transactionFlow, binaryMessageEncoding, windowsStreamSecurity, tcpTransport

  3. windowsStreamSecurity, tcpTransport, binaryMessageEncoding, transactionFlow

  4. binaryMessageEncoding, transactionFlow, tcpTransport, windowsStreamSecurity

Answer: Answer is b

<endpoint address="net.tcp://server/ContosoService"
<endpoint address="net.pipe://localhost/ContosoService"
name="netPipe" />

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?

  1. ChannelFactory <Contoso.IContoso> factory = new ChannelFactory <Contoso. IContoso>("Contoso.IContoso")
  2. ChannelFactory <Contoso.IContoso> factory = new ChannelFactory <Contoso. IContoso>("netNamedPipeBinding")
  3. ChannelFactory <Contoso.IContoso> factory = new ChannelFactory <Contoso. IContoso>("netPipe");
  4. ChannelFactory <Contoso.IContoso> factory = new ChannelFactory <Contoso. IContoso>("net.pipe//localhost/ContosoService");
Answer: Answer is c
Further Reading:

Useful Resources, ChannelFactory Constructor


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.