Quiz 4 with Solution - Intermediate Java Programming | COP 3804, Quizzes of Java Programming

Material Type: Quiz; Class: Intermediate Java Programming; Subject: Computer Programming; University: Florida International University; Term: Summer 2007;

Typology: Quizzes

Pre 2010

Uploaded on 03/10/2009

koofers-user-xgw
koofers-user-xgw 🇺🇸

5

(1)

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COP-3804 Intermediate Java Programming Quiz #4 Date: July, 5th 2007 Grade: _____/100
(This quiz consists of one page)
Name: _______________________________________________ Last 4 digits PantherID: __________
1. An example of a GUI component is
ActionEvent
actionPerformed
JTextField
ActionListener
2. In what package do you find the JButton, JTextField and JComboBox classes?
javax.swing
java.lang
java.awt
java.io
3. A GUI component even though created can be still hidden.
True
False
4. In order to process an event when the user clicks on a button, what should be done? (Check all that apply)
Code a class that implements the ActionListener interface.
Instantiate an object (a listener) of the class above.
Call the actionPerformed method.
Register the listener on the button.
5. Assuming everything has been coded correctly, what happens when the user clicks on a button?
The actionPerformed method executes.
The JButton constructor executes.
The main method executes.
6. A class extending the JFrame class can also implement a listener interface.
True
False
7. Components can be nested.
True
False
8. The interface KeyListener defines three methods: keyPressed, keyTyped and keyReleased. We want to build a class
that implements KeyListener. We need to implement
keyPressed only
keyReleased only
keyTyped only
All three methods
9. You are designing a GUI with three buttons; a different action will be taken depending on which button the user
clicks. You want to code one inner private class implementing the ActionListener interface. Inside actionPerformed,
which method do you call to determine which button was clicked?
getButton
getSource
getOrigin
10. The MouseAdapter class has the following features: (check all that apply)
implements all the methods in the MouseListener interface.
implements only the mouseClicked method.
instances of MouseAdapter class can be created.

Partial preview of the text

Download Quiz 4 with Solution - Intermediate Java Programming | COP 3804 and more Quizzes Java Programming in PDF only on Docsity!

COP-3804 Intermediate Java Programming Quiz #4 Date: July, 5th^2007 Grade: _____/

(This quiz consists of one page)

Name: _______________________________________________ Last 4 digits PantherID: __________

  1. An example of a GUI component is ActionEvent actionPerformed JTextField ActionListener
  2. In what package do you find the JButton , JTextField and JComboBox classes? javax.swing java.lang java.awt java.io
  3. A GUI component even though created can be still hidden. True False
  4. In order to process an event when the user clicks on a button, what should be done? (Check all that apply) Code a class that implements the ActionListener interface. Instantiate an object (a listener) of the class above. Call the actionPerformed method. Register the listener on the button.
  5. Assuming everything has been coded correctly, what happens when the user clicks on a button? The actionPerformed method executes. The JButton constructor executes. The main method executes.
  6. A class extending the JFrame class can also implement a listener interface. True False
  7. Components can be nested. True False
  8. The interface KeyListener defines three methods: keyPressed , keyTyped and keyReleased. We want to build a class that implements KeyListener. We need to implement keyPressed only keyReleased only keyTyped only All three methods
  9. You are designing a GUI with three buttons; a different action will be taken depending on which button the user clicks. You want to code one inner private class implementing the ActionListener interface. Inside actionPerformed , which method do you call to determine which button was clicked? getButton getSource getOrigin
  10. The MouseAdapter class has the following features: (check all that apply) implements all the methods in the MouseListener interface.

implements only the mouseClicked method.

instances of MouseAdapter class can be created.