These questions are from a walk-in of HCL Noida. HCL conducted an Walk-in. This opening was for WCF professionals basically. They make their way of selection on the basis of direct technical interviews with 3 rounds. One of attendee has shared these interview questions.
Please note, these interview questions are not meant for a ready-made cheatsheet to remember and crack HCL interviews but for preparation and understanding on the technology. These questions are common and ask in many companies not only in HCL. So just take it as the points for preparation and enjoy!
1. For what purpose WCF is used in your current project?
Answer: Be specific to your answer. Interviewer is trying to understand your understanding on technology as well your interest on your project. Don't try to explain the features of WCF but just give specific requirement for which WCF was chosen in your project.
2. What is binding in WCF?
Answer: Here, don't just answer "Binding defines How part of a service". Try to answer with practical aspect and elaborate it. Binding is an attribute of endpoint, used to specify communication details for a WCF service using 3 elements- transport protocol, message encoding, and security. This binding object is comprised of several binding-elements that are correspondent to a particular channel-stack of a channel. Our specified details in these binding elements are evaluated by service-runtime whenever an endpoint is constructed. There are many system provided bindings ready for our use. We can customize the behavior of a binding by customizing/changing its properties. If these system provided bindings are not fit for our service, we can create our own binding using "CustomBinding" class.
3. So, how many bindings are there? Have you ever used netMsmqBinding or netNamedPipeBinding?
Answer: Be prepared for this question as it covers your understanding on different bindings. I would recommend you to go through this MSDN link to understand in which scenario you should pick which binding.
4. See, my hosted service is chargeable and I want to track the record that who has called/ accessed my service how many time, how can I do it?
Answer : With this question, interviewer just wanted to know whether you are aware about WCF Extensibility or not. WCF Extensibility is a great feature that enable us to customize & manage service calls. For this question, the answer is: "Parameter Inspector" extension point is used to check and manage WCF service calls. In that we can use BeforeCall() and AfterCall() methods. Parameter Inspector is a WCF extension point. We can inject it in WCF pipeline at client side or server side where we want to validate or customize the call. We can check, modify and reject the call at both places.
Somewhere, you may be ask with a different name "Interceptors in WCF". Interceptor in WCF is nothing but a component that we can plugged into any pipeline stage of WCF.
5. I want to restrict the concurrent access of my service to limited users, how can I do that? Where this setting is done?
Answer: Refer:WCF Service Throttling behavior
6. How session management is done in WCF?
Answer: In WCF, session management is quite different than asp.net. In asp.net, session is manage & maintained at server but in WCF, a session is initiated /terminated by client application. Client application get processed message from server within a session that was initiated by it. This session can be used as an extensibility point by server application. Since, it is not maintained at server side, whatever messages are received by service at server, get processed in the order they reached. Also, in asp.net, we have data store facility for session (session variables) but this facility is not available in WCF. A service contract is required to be decorated with SessionMode attribute for session handling setting.
7. How WCF service is secured?
Answer : Refer MSDN - Securing Services
8. Is there any way to give service access permission to role specific user group?
Answer : Refer WCF service access permission to a role specific user group
9. Is overloading possible in WCF? If yes then how?
Answer : Yes, by using [OperationContract(Name="OverloadedName")] But, still outer world will get them with unique and different name. Overloading is a technique to write manageable/maintainable code. But in case of WCF service, uniqueness is required for generating WSDL, and that can be done either by using unique method name or unique OperationContract's name attribute value. Interfaces plays an important role and provides much flexibility for this. We can write many implementations of an interface, and it gives more flexibility plus concise. So why to think on overloading for WCF service methods?
New Questions added on 05-April-2015:
10. What is MAC in WCF ?
11. How Event Logging is done in WCF ?
If you have also attended and want to share questions, please do send me the same at [email protected]
You may also like these WCF related posts :