Some true/false questions similar to those that may be asked.

1.True/False: It is not possible for a superclass to call a subclass's method.

2.True/False: If a method in a subclass has the same signature as a method in the superclass, the subclass method overloads the superclass method.

3.True/False: Every class is either directly or indirectly derived from the Object class.

4.True/False: An abstract class is not instantiated, but serves as a superclass for other classes.

5.True/False: In an inheritance relationship, the subclass constructor always executes before the superclass constructor.

6.True/False: If two methods in the same class have the same name but different signatures, the second overrides the first.

7.True/False: Every class has a toString method and an equals method inherited from the Object class.

8.True/False: All methods in an abstract class must also be declared abstract.

9.True/False: When an interface variable references an object, you can use the interface variable to call all the methods in the class implementing the interface.

10.True/False: The ActionEvent argument that is passed to an action listener's actionPerformed method is the event object that was generated in response to an event.

11.True/False: The call stack is an internal list of all the methods that are currently executing.

12.True/False: By default the scroll bars are always displayed.

13.True/False: When a JList component is added to a JScrollPane object, a border will automatically appear around the list.

14.True/False: The System.exit method requires an integer argument that is an exit code, which is passed back to the operating system.

15.True/False: The ActionEvent argument that is passed to an action listener's actionPerformed method is the event object that was generated in response to an event.

16.True/False: The FlowLayout manager does not allow the programmer to align components.

Additional Questions

  1. Give an example of a class header which implements 3 interfaces
  2. Why would you define an abstract class?
  3. Why would you define a final class?
  4. Why would you define a final method?
  5. Why would you define an abstract method?
  6. What do we mean by “event-driven programs”?
  7. What is the relationship between the AWT library and the Swing library?
  8. What does a layout manager do?
  9. Describe the behavior of the FlowLayout manager, and the BorderLayout manager.
  10. How Radio buttons differ from regular buttons? How are they the same?
  11. What are “decorations”?
  12. Assume that message and panel have been created and initialized. In what order would you execute the following statements to display message on a JFrame object?

(1) panel.add(message);

(2) setVisible(true);

(3) add(panel);

  1. What will be displayed when the following statement is executed?

JOptionPane.showMessageDialog(null, "Incorrect data type", "Warning",

JOptionPane.WARNING_MESSAGE);

  1. Give the code to add the JList object addressList to a scroll pane named scrollPane.
  2. What is a “mnemonic”?
  3. If the combo box referenced by addressList contains a set of values, what does the following code do?

int index;

String address;

index = addressList.getSelectedIndex();

address = addresses[index];

  1. What does the following statement do?

JTextArea textField = JTextArea(message, 25, 15);

  1. Assuming myTextField references a JTextField object, what will be the results of executing the following statements?

myTextField.setEditable(true);

myTextField.setText("Tiny Tim");