Com Interview Questions
 
Q: What is IUnknown? What methods are provided by IUnknown?
Ans : It is a generally good idea to have an answer for this question if you claim you know COM in your resume. Otherwise, you may consider your interview failed at this point. IUnknown is the base interface of COM. All other interfaces must derive directly or indirectly from IUnknown. There are three methods in that interface: AddRef, Release and QueryInterface.
Date submitted :8/8/2009 1:03:38 AM
Submitted by : shabir@myfaithsolution.com

Q: What are the purposes of AddRef, Release and QueryInterface functions?
Ans : AddRef increments reference count of the object, Release decrements reference counter of the object and QueryInterface obtains a pointer to the requested interface.
Date submitted :8/8/2009 1:03:38 AM
Submitted by : shabir@myfaithsolution.com

Q: What should QueryInterface functions do if requested object was not found? parameter.
Ans : Return E_NOINTERFACE and nullify its out
Date submitted :8/8/2009 1:03:38 AM
Submitted by : shabir@myfaithsolution.com

Q: What should QueryInterface functions do if requested object was not found?
Ans : Return E_NOINTERFACE and nullify its out parameter
Date submitted :8/8/2009 1:03:38 AM
Submitted by : shabir@myfaithsolution.com

Q: How can would you create an instance of the object in COM?
Ans : Fine, it all depends on your project. Start your answer from CoCreateInstance or CoCreateInstanceEx, explain the difference between them. If interviewer is still not satisfied, you?ll have to explain the whole kitchen behind the scenes, including a difference between local server and inproc server, meaning and mechanism of class factory, etc. You may also mention other methods of object creation like CoGetInstanceFromFile, but discussion will likely turn to discussion of monikers then.
Date submitted :8/8/2009 1:03:38 AM
Submitted by : shabir@myfaithsolution.com

Q: What happens when client calls CoCreateInstance?
Ans : Again, all depends on the level of detail and expertise of interviewer. Start with simple explanation of class object and class factory mechanism. Further details would depend on a specific situation.
Date submitted :8/8/2009 1:03:38 AM
Submitted by : shabir@myfaithsolution.com