COM (Component Object Model) MCQs

COM (Component Object Model) MCQs

Answer these 100+ COM (Component Object Model) MCQs and assess your grip on the subject of COM (Component Object Model).
Scroll below and get started!

1: IDispatch is an example of which kind of interface ?

A.   Standard

B.   Custom

C.   Dispatch

D.   Dual

E.   b and c.  

2: Identify the incorrect statement :

A.   COM defines a binary standard for component interoperability.

B.   COM is provided on multiple platforms like Windows, Macintosh and UNIX.

C.   COM provides for robust evolution of component-based applications and systems.

D.   COM does not support communication across network boundaries.

E.   COM provides mechanisms for error and status reporting. 

A.   ActiveX has been renamed as COM.

B.   COM has been renamed as ActiveX.

C.   ActiveX is a technology built on COM.

D.   COM is a technology built on ActiveX.

E.   Both are the same.  

4: An interface that can be seen everywhere the component is referenced, including a client application, is scoped as

A.   Public

B.   Private

C.   Friend

D.   Reserved

E.   Protected  

5: Which of the following is the best language to use for defining interfaces ?

A.   C

B.   C++

C.   MIDL

D.   VC++

E.   Visual Basic  

6: Component objects always access other component objects :

A.   directly.

B.   through special communication softwares.

C.   through interface pointers.

D.   through API calls.

E.   b or c.  

7: Marshalling code is

A.   The code used for the creation of type libraries.

B.   The code used for the creation of the interface.

C.   The code used for registering a component in the system.

D.   The code used for creating error handling routines in the components.

E.   The code that packs parameters for a method call 

8: Identify the incorrect statement from the following :

A.   Shared memory management between components is not allowed in COM.

B.   COM provides mechanisms for communications between components.

C.   The components can communicate across process and network boundaries.

D.   COM supports dynamic loading of components.

E.   COM is programming language independent.  

9: Which method of the IDispatch interface is avoided through DispID binding ?

A.   Invoke

B.   GetTypeInfo

C.   GetTypeInfoCount

D.   GetIdsOfNames

E.   c and d. 

10: ActiveX is based on COM.
Which of the following is an incorrect statement regarding the requirements of an ActiveX control ?

A.   An ActiveX control must have a CLSID.

B.   An ActiveX control may or may not support the IUnknown interface.

C.   An ActiveX control must have a class object that implements IClassFactory.

D.   An ActiveX control must expose its properties, methods and events via dispatch interfaces or dual interfaces.

E.   An ActiveX Control must be a self-registering, in-process component 

11: In which of the following cases is marshalling code not used ?

A.   In all calls between a client and any out-of-process server (EXE), local or remote.

B.   In all calls between a client and any remote server, EXE or DLL.

C.   In calls between threads of a client and a server that have different threading models.

D.   In calls between a client and an in-process server.

E.   In calls between a client thread that resides in a different apartment than
the server thread. 

12: Which of the following is not a type of identifier ?

A.   Class identifier.

B.   Interface indentifer.

C.   Method identifier.

D.   Type Library Identifier.

E.   Category Identifier.  

13: IDL stands for :

A.   Interface Definition Language.

B.   Interface Defined Language.

C.   Inheritance Definition Language.

D.   Implicit Definition Language.

E.   Interface Dynamic Language.  

14: You want to register a COM component named mydll.dll. Which of the following is the correct syntax for registering the component ?

A.   Regserver32.exe c:\windows\system\mydll.dll

B.   Regsvr32.exe c:\windows\system\mydll.dll

C.   Regsvr mydll.dll

D.   Regsvr32 mydll.dll

E.   Regsvr32 /u c:\windows\system\mydll.dll 

15: Which is the base interface ?

A.   IUnknown

B.   COM

C.   IDispatch

D.   IDeclare

E.   IClassFactory  

16: Components can include

A.   User interface objects.

B.   Spellcheckers.

C.   Database access objects.

D.   a and c.

E.   a,b and c.  

17: How is the instancing property value of an externally creatable class different from a dependent object class ?

A.   Instancing property for an externally creatable class will have its value set to private, while all dependent objects will have their values set to publicnotcreatable.

B.   Instancing property for an externally creatable class will have its value set to publicnotcreatable, while all dependent objects will have their values set to private.

C.   Instancing property for an externally creatable class will not have its value set to private or publicnotcreatable, while all dependent objects will have their values set to publicnotcreatable or private.

D.   Instancing for an externally creatable class will have its value set to private or publicnotcreatable, while all dependent objects will not have their values set to publicnotcreatable or private.

E.   Instancing property for an externally creatable class will not have its value set to private , while all dependent objects will not have their values set to publicnotcreatable.  

18: The component needs to be run in a separate space or separate thread from the client application.Which type of server would you use ?

A.   In-process

B.   Out-process

C.   Remote

D.   a or b.

E.   b or c. 

19: An ActiveX control has persistent properties.Which interface must it implement ?

A.   IPersistStream

B.   IPersist

C.   IPersistStreamInit

D.   a or b.

E.   a or c 

20: Which of the following statements regarding marshalling code is not true ?

A.   Marshalling code is not always used.

B.   Marshalling code is only used on the server side.

C.   On the server side, marshalling code unpacks in and in-out parameters and calls the method locally.

D.   The marshalling code is implemented on the server side by a stub.

E.   A COM server developer can create custom marshalling code.  

21: Which of the following is the only feature of COM ?

A.   Templates

B.   Meta Data

C.   Constructors

D.   Try/catch exception handling

E.   Namespaces  

22: Which interface is used by a COM-using program to invoke a COM objects properties, methods and events by name ?

A.   IUnknown

B.   IDispatch

C.   Invoke

D.   Ideclare

E.   IClassFactory  

23: Under what registry key will the pathname of an out-of-process COM server be found ?

A.   HKCR\prog-id\Clsid

B.   HKCR\CLSID\{object-class-id}\LocalServer32

C.   HKCR\CLSID\{object-class-id}\ProgID

D.   HKCR\CLSID\{object-class-id}\TypeLib

E.   HKCR\CLSID\{object-class-id}\Version  

24: Which of the following interfaces is for accessing type information ?

A.   ITypeInfo

B.   ICreateTypeInfo

C.   ICreateTypeLib

D.   ITypeLib

E.   ITypeLib2 

25: A proxy is :

A.   a type of interface.

B.   a special method of a COM object.

C.   a call to a method of a COM object.

D.   an object that runs in the caller's address space.

E.   an object that runs in the server process. 

26: The basic unit of thread safety in COM is called a

A.   apartment

B.   class

C.   interface

D.   Block

E.   Fragment 

27: How are interfaces versioned ?

A.   By using type libraries.

B.   By using IIDs.

C.   By using GUIDs.

D.   One cannot version interfaces, every interface is new.

E.   By using IDL 

28: IClassFactory is an example of which kind of interface ?

A.   Standard

B.   Custom

C.   Dispatch

D.   Dual

E.   a and d.  

29: Which of the following statements is incorrect regarding dispatch interfaces ?

A.   Dispatch interfaces get their name from the fact that are implemented using the COM interface IDispatch.

B.   A dispatch interface allows callers to query an object an object at runtime for a list of its automation methods and parameters and then invoke these methods.

C.   Scripting languages like VBA and VBScript can make use of both dispatch and vtable interfaces.

D.   COM objects that expose dispatch interfaces are referred to as Automation objects or Automation servers.

E.   Dispatch interfaces make it much easier for tools such as Visual Basic and PowerBuilder to be adapted to use COM objects.  

30: Which of the following statements regarding DCOM is incorrect ?

A.   DCOM is based on the COM technology.

B.   It is a low-level extension of the COM technology.

C.   DCOM is designed to run only on Windows platforms.

D.   DCOM is layered on the Open Group Distributed Computing Environment RPC mechanism.

E.   Using DCOM, applications are not forced to upgrade each time the object changes, as this is done automatically.  

31: Which interface is to be implemented by a class which is designed especially to manufacture other COM objects ?

A.   IUnknown

B.   IClassFactory

C.   IDispatch

D.   IDeclare

E.   Invoke  

32: Which of the following is not a disadvantage of MIDL ?

A.   MIDL is relatively complex.

B.   MIDL clearly separates interface from implementation.

C.   All out parameters must be pointers.

D.   Function overloading is not supported.

E.   The return type for methods in object interfaces must be an HRESULT. 

33: What function can you use to add information about a type library to the system registry ?

A.   RegisterTypeLib

B.   RegTypeLib

C.   RegTlb

D.   RegisterTlb

E.   RegType  

34: IIDs are GUIDs that refer to :



A.   Interfaces

B.   Classes

C.   Type Libraries

D.   Methods

E.   Categories  

35: What are the various types of marshalling ?

A.   Standard

B.   Custom

C.   Standard, custom

D.   Standard, custom, in-built

E.   Standard, in-built  

36: When a GUID is used to identify a COM object, it is known as a :

A.   Interface

B.   ProgID

C.   CLSID

D.   IID

E.   LIBID 

37: The LockServer method is used to :

A.   Prevent other clients from accessing the resources of the object until the lock is removed.

B.   Is used to store the state of an object on the hard disk.

C.   Keep a component open in memory, thus allowing instances to be created more quickly.

D.   Prevent the component from crashing.

E.   Destroy a component that is open and no longer needed.  

38: Which is the incorrect statement about GUIDs ?

A.   GUIDs are integers that are guaranteed to be unique in the world across space and time.

B.   They uniquely identify every interface.

C.   They uniquely identify every component object class.

D.   The GUIDs are embedded in the type library.

E.   The GUIDs are used by the COM system dynamically at bind time to ensure that no false connections are made between components. 

39: COM provides location transparency by :

A.   Interfaces.

B.   GUIDs.

C.   proxies and stubs.

D.   Type Libraries.

E.   IDL.  

40: What utility will you use to install and run servers remotely via DCOM ?

A.   DCOM

B.   DCOMRUN

C.   DCOMUTIL

D.   DCOMCNFG

E.   DCOMCN  

41: Which of the following statements is incorrect regarding the IUnknown interface ?

A.   A COM object that has multiple interfaces has only one implementation of the IUnknown interface.

B.   All calls to QueryInterface for a single COM object must behave in the same manner at all times.

C.   QueryInterface is the mechanism by a caller gains access to the other services defined by an object.

D.   AddRef and Release point to the fact that the lifetimes of COM objects are controlled through reference counting.

E.   The IID for IUnknown, is called IID_IUnknown, and is defined in the COM header file since it is a standard interface defined by Microsoft. 

42: The AddRef method of the IUnknown interface is :

A.   Invoked to let the COM object know about a new reference to the object.

B.   Invoked to let the COM object know that a reference is no longer needed.

C.   Invoked when the COM object is destroyed.

D.   Invoked when the COM object is instantiated.

E.   Always invoked after the Release method. 

43: How many bytes is a GUID ?

A.   4

B.   8

C.   16

D.   32

E.   64  

44: Which of the following languages/tools can interact with COM through dispatch interfaces ?

A.   VBScript

B.   PowerBuilder

C.   Visual Basic

D.   a and c.

E.   a,b and c. 

45: How many different kinds of interfaces are there in COM?

A.   3

B.   4

C.   5

D.   6

E.   7 

46: Which of the following is not a feature of COM ?

A.   No language dependency.

B.   Location transparency.

C.   Interface definition.

D.   Unique naming of Classes and Interfaces.

E.   No provision for meta data 

47: Which interface must be supported by a COM object ?

A.   IUnknown

B.   Invoke

C.   IDispatch

D.   IDeclare

E.   IClassFactory 

48: MIDL stands for

A.   Microsoft Interface Definition Language.

B.   Macro Interface Definition Language.

C.   Multiple Interface Definition Language.

D.   Macro Identification Language.

E.   Minimum Interface Definition Language 

49: Identification of the COM object stored in the Windows registry is known as :

A.   ComID

B.   ProgID

C.   ClassID

D.   ObjectID

E.   ComponentID  

50: A component category is identified by :

A.   CLSID

B.   ID

C.   IID

D.   CATID

E.   LIBID