Computer Education Introduction to Computer Science Using Java™ Computer Education Introduction to Computer Science Using Java™   Glencoe Online
Computer Education Home Product Information Site Map Search Contact Us

Students

Self-Assessment Exercises

Chapter 6: Event-Driven Programming
      
  1.Suppose you are creating a class that responds to mouse clicks. Which import should you use?  
  a.   import java.awt.event;  
  b.   import java.awt.mouse;  
  c.   import java.gui.event;  
  d.   import java.gui.mouse;  
      
  2.Your class from the previous question uses the MouseListener interface. How many methods must you implement for MouseListener?  
  a.   0  
  b.   1  
  c.   3  
  d.   5  
      
  3.The Java framework provides a Timer class which can raise a(n) ________ whenever a specified amount of time has passed.  
  a.   Alarm event  
  b.   Alarm flag  
  c.   Clock event  
  d.   Timer event  
      
  4.In order to use a Timer, you implement the ActionListener interface. This requires that you define the actionPerformed() method. Which of the following is the correct actionPerformed() method heading?  
  a.   private void actionPerformed( ActionEvent evt )  
  b.   public void actionPerformed( ActionEvent evt )  
  c.   private void actionPerformed( TimerEvent evt )  
  d.   public void actionPerformed( TimerEvent evt )  
      
  5.A(n) ________ class is a class defined inside another class.  
  a.   anonymous  
  b.   inner  
  c.   inside  
  d.   nested  

 

McGraw-Hill Glencoe   The McGraw-Hill Companies
Self-Assessment Exercises
Java Compilers
Source Code
Java Resources
PowerPoint® Presentations
Home