Basic COM  «Prev  Next»

Query Interface - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 

1. When asked for IUnknown, an object's implementation of QueryInterface can:
Please select the best answer.
  A. Return any COM interface to the caller because all COM interfaces implement IUnknown
  B. Return E_NOINTERFACE
  C. Always return the same interface pointer as its implementation of IUnknown

2. Read the following code carefully. Which of the following are problems with the code?
  Code examplet
 
Please select all the correct answers.
  A. if (riid == IID_IMyComInterface || riid == IID_IUnknown)
  B. else if (riid == IID_IYourComInterface)
  C. *ppv = (IMyComInterface *) this;
  D. AddRef--i.e., (*ppv)->AddRef()--is not called.