Read the most frequently asked 50 top WCF multiple choice questions and answers PDF for freshers and experienced
WCF Objective type Questions and Answers List
1. Which of the following is NOT true?
A) A WCF Service can be consumed by Windows applications
B) A WCF Service can be consumed by Web applications
C) A WCF Service can perform calculations
D) A WCF Service cannot return a dataset
2. WCF services can communicate with _______.
A) all programming languages
C) only the languages included with Visual Studio .NET
D) multiple platforms and multiple languages
3. The standard method for storing data that can be transferred easily from one machine or platform to another is _______.
4. One of the advantages of using _______ is that data are transmitted in a text format rather than a binary format.
5. Data that is in _______ format can pass through many firewalls that _______ cannot penetrate.
A) binary, text
B) text, binary
C) SOAP, WCF
D) WCF, SOAP
6. _______ is a popular standard that includes a set of rules for handling requests and responses including class names, method names, and parameters.
7. The information about the names of the methods, the parameters that can be passed, and the values that are returned from the functions is controlled in some Web services by a description specified in _______.
8. Always end your URI (or URL) with a ________ to avoid an extra trip to the server to determine that it is a site rather than a directory.
D) double slash
9. A resource on the Web is uniquely identified by its URI, which means _______.
A) Uniform Resource Identifier
B) Universal Registered Identifier
C) Uniform Registered Identifier
D) Universal Resource Identifier
10. To add a WCF Service, select the solution name in the Solution Explorer and select _______ from File menu.
A) Add / New Solution
B) Add / New Web Site
C) Add / New Service
D) Add / New Library
11. 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?
D. All of these
12. 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:
A. The data types of messages
B. The specific protocols and serialization formats
C. The location of the operations
D. The frequency of messages per second
13. 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?
14. 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?
15. 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?
A. Service contract interfaces can extend any number of other service contract interfaces.
B. You can modify the implementation of a service contract by changing the interface implementation, while the service contract remains the same
C. A single class can implement any number of service contracts by implementing those service contract interfaces.
D. All of these
16. 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?
B. All of these are disadvantages
D. Multiple Inheritance
17. Which of the following is TRUE regarding service operations and references to objects?
A. Objects must be serializable
B. You can’t return values from service operations
C. Objects are passed as references
D. You can’t pass parameters to service operations
18. 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?
A. Add the DataMemberAttribute and change the type to public
B. Add the DataContractAttribute to the attribute
C. Change the type to internal
D. Add the DataMemberAttribute or change the type to public
19. A developer has designed a service that contains a method called TakeAction which is decorated with the following attribute:
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?
A. Use object as the return type
B. Use FaultException as the return type
C. Remove all parameters from the method signature
D. Use void as the return type
20. 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?
B. none of these
21. Study the following line of code:
The ICalendarDuplexCallback interface is defined as the CallbackContract property in the Service Contract. In which class should you use this line of code?
B. You should never use this
22. 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?
A. Set the ProtectionLevel to None in the ServiceContractAttribute
B. Set the ProtectionLevel in the OperationContractAttribute to EncryptAndSign for each of the sensitive methods
C. Nothing, all messages will be encrypted and signed already
D. Set the ProtectionLevel to Sign in the ServiceContractAttribute
23. Which of the following is FALSE regarding the WSHttpBinding class?
A. Provides WS-Addressing
B. Provides un-encrypted messages by default
C. Provides reliable messaging
D. Provides transactions
24. In Windows Communication Foundation (WCF) applications, which of the following is FALSE regarding Sessions?
A. Messages delivered during a session are processed in the order in which they are received
B. They are explicitly initiated and terminated by the receiving application
C. There is no general data store associated with a WCF session
D. Sessions correlate a group of messages into a conversation
25. 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. A new InstanceContext is created for each call
B. A new InstanceContext is created for each channel
C. A new InstanceContext is created for all calls
D. A new InstanceContext is never created
26. 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?
A. System.ServiceModel – bindings – endpoint
B. System.ServiceModel – services – service – endpoint
C. System.ServiceModel – endpoint
D. System.ServiceModel – behaviors – behavior – endpoint
27. 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?
D. All of these
28. Which class in WCF represents the unit of communication between endpoints in a distributed environment?
28. Windows Communication Formats (WCF) is Microsoft’s technology for communicating between applications on the same computer system, on a network, or across the
29. It is possible for a single application to be both a client and a service.
30. WCF cannot communicate with other platforms that support SOAP and simple XML.
31. An endpoint indicates where messages can be sent (address).
32. Data that is in binary format can pass through any firewall.
33. WSDL contains information about the names of the methods, the parameters that can be passed, and the values that are returned from the functions.
34. For technical specifications, the industry standard term URL is preferred to URI.
35. The transport protocol used by SOAP is HTTP.
36. To rename a Web Service you need to change only the name in the Solution Explorer.
37. When a new project is added to a WCF Service solution, the projects are saved independently.