Basic COM  «Prev  Next»

COM Client Server Interaction and Method Requirements - Quiz

Each question is worth one point. Select the best answer or answers for each question.
1. What is the basis of client-server interaction in COM?
Please select the best answer.
  A. Direct calls from the client into the COM object's implementation code
  B. Communication between the client and a COM object's data
  C. Communication between the client and a COM object's interface methods

2. What does local/remote transparency mean?
Please select the best answer.
  A. The client tells COM where to find the server. The location of the server is transparent to COM.
  B. The client accesses COM objects. The location of the server implementing those objects is transparent to the client.
  C. The COM server registers with all known clients. This process is transparent to the COM object.

3. What are the binary and return value requirements of a COM method?
Please select all the correct answers.
  A. The __stdcall calling convention, not the C/C++ default __cdecl.
  B. COM methods must return application-specific error codes as return values.
  C. Return HRESULT.
  D. First parameter to a method must be a pointer back to the interface that contains the method.

4. What role does IUnknown play in client-server interaction?
Please select the best answer.
  A. Every COM interface derives from IUnknown, which supplies QueryInterface, AddRef, and Release.
  B. It is an optional base interface that a server implements only when the object supports more than one interface.
  C. It is implemented by COM itself rather than by the object, so a server never writes those three methods.
  D. It must be requested from the registry by name before any other interface on the object can be used.

5. A client calls a method on an object implemented in a separate process. What makes that call work?
Please select the best answer.
  A. COM copies the server's code into the client's process so the call becomes an ordinary in-process call.
  B. The client opens a socket to the server and formats the request itself.
  C. COM writes the call into the registry, which the server polls for pending requests.
  D. COM creates a proxy in the client's process and a stub in the server's process; the proxy marshals the arguments across the process boundary and the stub makes the real call.

6. Which statements about QueryInterface are correct?
Please select all the correct answers.
  A. A successful call calls AddRef on the returned pointer, so the client must Release it when finished.
  B. It must return E_NOINTERFACE when the requested interface is not supported.
  C. It may return a different IUnknown pointer each time it is asked for IUnknown on the same object.
  D. If it succeeds for interface B when called on interface A, it must also succeed for interface A when called on interface B.