Page 202 - Open Soource Technologies 304.indd
P. 202
Event Driven Programming
8.9 Self Assessment Questions
1. You have created a new property procedure in a class module. You have not specified its
Scope. What scope is it?
(a) Private (b) Friend
(c) Public (d) Global
(e) None
2. What is the syntax to assign the return value for a Property Get procedure named LastName,
where LastName is a String?
(a) Set LastName = ReturnValue
(b) Return ReturnValue
(c) Exit ReturnValue
(d) LastName = ReturnValue
3. How do you implement callback functionality from a class to its calling code in a standard
executable?
(a) Provide a custom class event with at least one Boolean By Val parameter.
(b) Provide a custom class event as a function with a Boolean return value.
(c) Provide a custom class event with at least one By Reference parameter.
(d) There is no way to provide callback functionality from a class in a standard executable.
4. When does an event procedure for a class’s custom event appear in the code window of
a VB application?
(a) You must manually declare the event procedure.
(b) After you write a declaration of the event in the class.
(c) After you use WithEvents to declare an object variable of the class.
(d) After you write code in the class to raise the event.
5. You are designing a class module that will be used as a standalone EXE server. Which of
the following is true about the Instancing property for the class?
(a) The class must be defined Private.
(b) A PublicNotCreatable class must have another class that provides access to it.
(c) A program using a class defined as GlobalMultiUse needs to explicitly
mention the class name to use its properties and methods.
(d) The class can be defined as SingleUse.
6. A module-level variable is visible to a watch of which type of scope?
(a) Global
(b) Module-level
196 LOVELY PROFESSIONAL UNIVERSITY