Home | Interview Questions
Interview Questions | Windows 7, CRM, SharePoint, SQL Server, Windows Server, .NET..
Copyright © Accelerated Ideas 2017

Windows Communication Foundation (WCF) Interview Questions




Below are a collection of Windows Communication Foundation (WCF) interview questions. They include questions on Windows Communication Foundation topics such as endpoints, contracts, attributes, signatures, bindings and contexts.

They are suitable for the following job roles:

  • .NET Developer
  • C# Developer
  • Analyst Developer
  • Web Developer
  • .NET 3.5/4.0 Developer


We wrote these questions for other IT professionals to help them practice for their next interview or technical test. They are suitable for both consultants, temp staff or full time permanent roles.

If the organisation is using Windows Communication Foundation then these questions should help you out..

Interview Questions



1. You have created a new service based on Windows Communication Foundation and also a client application to test the service. You want add an endpoint in the web.config file of the client application to use the new service. Which values should you include in you service element of the web.config file?

Address
Contract
Binding
All of these

Show Answer

2. A service contract specifies what an endpoint communicates to the outside world. At a more concrete level, it is a statement about a set of specific messages organized into basic message exchange patterns (MEPs), such as request/reply, one-way, and duplex. Which of the following is NOT part of the Service Contract specification:

The data types of messages
The specific protocols and serialization formats
The location of the operations
The frequency of messages per second

Show Answer

3. Services are groups of operations. To create a service contract you usually model operations and specify their grouping. In Windows Communication Foundation (WCF) applications, developers define the operations by creating a method and marking it with the which attribute?

ServiceContractAttribute
DataMemberAttribute
DataContractAttribute
OperationContractAttribute

Show Answer

4. You’ve created a new class in your .NET project that contains a wide variety of operations grouped together to form part of a Server Contract. You now need to add an attribute to the class to define it as a service contract. Which attribute should you use?

OperationContractAttribute
DataMemberAttribute
DataContractAttribute
ServiceContractAttribute

Show Answer

5. Both classes and interfaces represent a grouping of functionality and, therefore, both can be used to define a WCF service contract. However, it is recommended that you use interfaces because they directly model service contracts. Without an implementation, interfaces do no more than define a grouping of methods with certain signatures. Which of the following is a benefit of using interfaces to define Service Contracts?

Service contract interfaces can extend any number of other service contract interfaces.
You can modify the implementation of a service contract by changing the interface implementation, while the service contract remains the same
A single class can implement any number of service contracts by implementing those service contract interfaces.
All of these

Show Answer

6. You have created a new class which will be the basis for a Service Contract. You have used ServiceContractAttribute and OperationContractAttribute to decorate the class and the methods. Which of the following is NOT an advantage of using classes instead of interfaces for Service Contracts?

Speed
All of these are disadvantages
Simplicity
Multiple Inheritance

Show Answer

7. Which of the following is TRUE regarding service operations and references to objects?

Objects must be serializable
You can’t return values from service operations
Objects are passed as references
You can’t pass parameters to service operations

Show Answer

8. You’ve created a new class and decorated it with the DataContractAttribute so that it forms a Data Contract for WCF. This class contains several attributes that you want to make available as part of the Data Contract. Currently these attributes are declared as private. What do you need to do to ensure these attributes are serializable?

Add the DataMemberAttribute and change the type to public
Add the DataContractAttribute to the attribute
Change the type to internal
Add the DataMemberAttribute or change the type to public

Show Answer

9. A developer has designed a service that contains a method called TakeAction which is decorated with the following attribute:

[OperationContractAttribute(IsOneWay=true)]

Another client application will invoke the TakeAction operation and continue processing after WCF writes the message to the network. What must the developer of the TakeAction method do to ensure the client action can call this method?

Use object as the return type
Use FaultException as the return type
Remove all parameters from the method signature
Use void as the return type

Show Answer

10. The signature of a service operation dictates a certain underlying message exchange pattern (MEP) that can support the data transfer and the features an operation requires. You want to adopt a pattern that supports the sending and receiving of messages by both the service and client. Which patter should you choose?

one-way
none of these
request/reply
duplex

Show Answer

11. Study the following line of code:

OperationContext.Current.GetCallbackChannel();

The ICalendarDuplexCallback interface is defined as the CallbackContract property in the Service Contract. In which class should you use this line of code?

Client
You should never use this
Both
Service

Show Answer

12. A client application interacts with a new Service that calculates interest rates for the banks customers. The Service Contract contains BasicHttpBinding as the binding type in the endpoint configuration. The service contains some methods that return sensitive information such as customers names and addresses. You want to ensure that these methods are encrypted. What should you do?

Set the ProtectionLevel to None in the ServiceContractAttribute
Set the ProtectionLevel in the OperationContractAttribute to EncryptAndSign for each of the sensitive methods
Nothing, all messages will be encrypted and signed already
Set the ProtectionLevel to Sign in the ServiceContractAttribute

Show Answer

13. Which of the following is FALSE regarding the WSHttpBinding class?

Provides WS-Addressing
Provides un-encrypted messages by default
Provides reliable messaging
Provides transactions

Show Answer

14. In Windows Communication Foundation (WCF) applications, which of the following is FALSE regarding Sessions?

Messages delivered during a session are processed in the order in which they are received
They are explicitly initiated and terminated by the receiving application
There is no general data store associated with a WCF session
Sessions correlate a group of messages into a conversation

Show Answer

15. The instancing behaviour (set by using the System.ServiceModel.ServiceBehaviorAttribute.InstanceContextMode property) controls how the InstanceContext is created in response to incoming messages. You have created a new WCF service and set the InstanceContextMode to PerCall. What is the behaviour of the InstanceContext in this mode?

A new InstanceContext is created for each call
A new InstanceContext is created for each channel
A new InstanceContext is created for all calls
A new InstanceContext is never created

Show Answer

16. When configuring a WCF service using Visual Studio, you can use either a Web.config file or an App.config file to specify the settings. The choice of the configuration file name is determined by the hosting environment you choose for the service. Where does the endpoint configuration element lie in a .NET configuration file?

System.ServiceModel – bindings – endpoint
System.ServiceModel – services – service – endpoint
System.ServiceModel – endpoint
System.ServiceModel – behaviors - behavior – endpoint

Show Answer

17. The System.ServiceModel.Channels namespace contains the DeliveryFailure enumeration. DeliveryFailure specifies the possible types of delivery failure for a message read from the queue. Which of the following elements is a valid DeliveryFailure?

All of these
BadSignature
AccessDenied
ReceiveTimeout

Show Answer

18. Which class in WCF represents the unit of communication between endpoints in a distributed environment?

RequestContext
Message
Binding
ChannelBase

Show Answer





Popular



Windows Server 2016
Amazon Web Services

Windows Server
Windows Server 2008
Windows Server 2012
Windows Server 2016

SQL Server
SQL Server 2008 (Administrator)
SQL Server 2008 (Support)
SQL Server 2016

Solution Architect
AWS

Windows Desktop
Windows 7
Windows 8

Development
Windows Commmunication Foundation
Windows Workflow Foundation

Disaster Recovery
Disaster Recovery (General)

Microsoft Office
Word 2010

Project Manager
Project Management (General)

SharePoint
SharePoint 2010





English English  |  Portuguese Portuguese