Sun Java Solaris Communities My SDN Account Join SDN
 
Quizzes

JavaBeans Quiz

 

Quizzes Index

Quiz


February 2001

Duke The JavaBean 101 tutorials, parts I, II, and III explained components and how to test beans in the Bean Developer's Kit. Take this quiz to test your knowledge of the JavaBeans architecture.
1. What do you have to do to make an instance variable into a JavaBean property?
 A. Declare the instance variable public and static.
 B. Define a get method and a set method for the variable.
 C. Drop the Bean into the BeanBox property sheet.
 D. Declare the instance variable private and let the BeanBox define get and set methods for the variable.


2. An application builder tool can analyze how JavaBeans work. Which mechanism does the tool use?
 A. Persistence
 B. Method customization
 C. Introspection
 D. Event delegation


3. Properties control what aspects of a JavaBean?
 A. The communication between JavaBeans.
 B. A JavaBean's appearance and behavior.
 C. How a JavaBean is compiled and dropped into the BeanBox (or other tool).
 D. The tools you can use to customize a JavaBean.


4. JavaBean methods are all
 A. Events
 B. Properties
 C. Event listeners
 D. Identical to methods of other Java classes


5. A source Bean is a JavaBean that fires an event, while the Bean that receives the event is called a
 A. Listener Bean
 B. Receiver Bean
 C. Enterprise JavaBean
 D. EventHandler Bean


6. JavaBeans and widgets are both considered to be reusable software components. However, JavaBeans differ from widgets because Beans
 A. Can be reused more rapidly than widgets.
 B. Define a design-time interface that tools can query.
 C. Take up less storage space that widgets.
 D. Can be run by more tools on more platforms than widgets.


7. The BeanBox is a JavaBean testing tool that comes with the Bean Developer's Kit. The BeanBox has the following windows:
 A. ToolBox, BeanBox, and Properties windows.
 B. ToolBox, BeanBox, and Garage windows.
 C. BeanBox, ToolBox, and Windows98 windows.
 D. Properties and ToolBox windows.


8. JavaBeans communicate with each other using events, such as action events. You establish the connection between Beans by:
 A. Writing a special adapter class.
 B. Using the BeanBox Edit -> Events menu and resulting dialog box to hook up one Bean to another.
 C. Having the BeanBox generate the special adapter class.
 D. Any of the above choices.


9. You use the Property sheet in the BeanBox tool to
 A. Add new properties to a Bean.
 B. Delete a Bean's property.
 C. Change the value of a Bean's property.
 D. All of the above.


10. The properties of a Bean
 A. May be inherited by the Bean from its superclass.
 B. Are defined by the Bean itself.
 C. Are analogous to instance variables.
 D. All of the above.
 E. None of the above.


11. Some JavaBeans are not meant to be visible and are referred to as invisible Beans. Such invisible Beans
 A. Have no GUI representation.
 B. Are able to fire events and save persistent state.
 C. Are invisible in builder tools.
 D. All of the above.
 E. A and B only.


12. A property defined in a JavaBean typically
 A. Is declared as a private type.
 B. Has a corresponding get method and set method.
 C. Can be saved and retrieved at a later time.
 D. All of the above.
 E. None of the above.


13. When you write the code for a new JavaBean, you can test it in the BeanBox. What do you have to do to be able to test the Bean in the BeanBox?
 A. Compile the Bean.
 B. Create a manifest file for the Bean.
 C. Create an executable JAR file for the Bean class and manifest file.
 D. Load the JAR file into the BeanBox using the LoadJar menu option, or place the JAR file in the default directory from which the BeanBox initializes and loads its Beans.
 E. All of the above.


14. When you write a get method for a JavaBean property, form the method name as follows:
 A. Use any name you want for the get method.
 B. Use only the property name for the get method.
 C. Use get followed by the property name, with the first letter of the property name capitalized.
 D. None of the above.


15. A manifest file for a JavaBean contains the following information:
 A. The name of the JavaBean's class file.
 B. An indicator that this is a JavaBean.
 C. A list of the properties declared by the JavaBean.
 D. A and B.
 E. A, B, and C.


16. Which kinds of properties can a Bean contain?
 A. Complex properties and Event-handling properties
 B. Constrained properties, Simple properties, Bound properties
 C. All of the above


17. A JavaBean that defines bound properties typically calls what methods so that other Beans can be notified of changes to the bound property?
 A. The addPropertyChangeListener method so a Bean can register an interest in notification of changes to the property.
 B. The reportChange method to send property change notification to interested Beans.
 C. The firePropertyChange method to send property change notification to interested Beans.
 D. The addActionListener method so a Bean can register an interest in notification of changes to the property.
 E. A and C
 F. D only
 G. All of the above


18. Bound properties appear in the BeanBox with what kind of event in the Edit -> Events menu?
 A. actionPerformed event
 B. propertyChange event
 C. mouse pressed event
 D. mouse moved event


19. Constrained properties are
 A. Identical to bound properties except that they are only used on certain platforms.
 B. Identical to bound properties except that the listener Bean can veto the property change.
 C. Identical to bound properties except that they are indexed.
 D. None of the above.


20. JavaBeans with constrained properties
 A. Instantiate a PropertyChangeSupport object.
 B. Use methods of the VetoableChangeSupport class.
 C. Instantiate an ActionListener object.
 D. A and B
 E. None of the above
 F. All of the above