The answers are in boldface.

  1. On an MS Windows system, if you write a program that uses a library function fun() from the library fickle.lib, and you then download and install a new version of fickle.lib which does not implement fun() and try to build your old program. What will happen? (HINT: its a .lib).

    Since it is a statically linked library, the linker will complain when it cannot resolve external references.

  2. On an MS Windows system, if you are writing a program that uses some other DLL file, in order for you to to link with it, it must

  3. Say you implement a class CVcr and export it as a .DLL. This DLL is shipped to your customers who link it with their programs. Later on you add a private data member to this class and ship the new version of your DLL. What will happen when your customers try to do something like CVcr vcr; in their programs?

  4. If you run the following code:

    class IFoo{
    public:
      virtual int _stdcall GetFirst();
    private:
      int m_nFirst;
    };
    
    ///then, later, in main()
    
    Ifoo * i = ...(get an object)
    Ifoo * j = ...(get a different object)
    
    
    How many vptr and vtbl will be created for this code?

    Its one vptr per instance, then one vtpl per class.

  5. Using standard C++, what is one technique that we can use for making available an interface as a DLL while still retaining the ability to make any changes to our implementation without breaking any existing programs that link with our DLL. That is, how can we achieve compiler independence in C++ without using COM?

    See the Adapter pattern. It works because the adapter does not have any data member that can change size (only a pointer to the real object).

  6. A COM Component is usually:

  7. A COM Object is

  8. COM is a

    Not, it is not proprietary. In fact, there do exist some non-Microsoft implementations of COM.

  9. In COM the IUnknown interface supports

  10. The QueryInterface function is implemented by

    An interface does not implement anything, it simply declares.

  11. Which one of these is something that every member function of a COM object must do.

    You can only allocate memory locally!

  12. The QueryInterface() function in COM allows you to

  13. The QueryInterface() is often implemented by

  14. The MIDL language is most similar to

  15. In a MIDL file, an attribute is

  16. In MIDL, the attribute that tells us that this is a COM interface is

  17. Version control is automatically "handled" in COM because

    That would be something. "You must support version control on your implementations". Yeah, that'll fly.

  18. Say you generate a program that implements the MIDL function

    
    HRESULT foo([in,ref] wchar_t * a, [in,ref] wchar_t *b );
          
    and is then called be the client with:
    p->foo(x,x);
          
    inside the function foo(), a and b are:

  19. If you want to pass a pointer to a function, and you want this pointer to behave just like a C++ pointer, and you are writing a MIDL interface file, you must:

  20. In order to pass an array as an argument in a MIDL declaration you must

  21. The library keyword in a MIDL interface file tells the MIDL compiler to

  22. The IDispatch interface in COM supports

  23. To specify that a COM interface supports dynamic invocation you must

  24. If you have two COM interface pointers and you want to determine if they belong to the same COM component, you can do this by

  25. The IUnknown::QueryInterface COM rules state that this function must be

  26. The problem with using nested classes to implement a COM object that has multiple interfaces is that:

  27. A COM standard class factory can be created by

  28. A COM component can run as (pick best).

  29. Every thread (client or server) that uses COM must initialize it by calling

  30. If you have implemented an out-of-process COM server and you want users to dynamically find it, you must

  31. COM components keep their own reference count by

  32. An out-of-process COM component knows that it is time to kill itself when

    ComponentRelease makes the signal only when the reference count reaches zero.

  33. An in-process COM component knows that it is time to kill itself when

  34. In order to facilitate the registration, every out-of-process COM component must

  35. In order to register an in-process COM component you can

  36. The COM call to create a COM object is

  37. When a client is done using COM interface it should

  38. When implementing a COM object that inherits from another COM object you must

  39. Objects in a COM apartment share

  40. A Single Threaded Apartment implementation must


Copyright © 2001 José M. Vidal. All Rights Reserved.