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
- Give an example of a class header which implements 3 interfaces
- Why would you define an abstract class?
- Why would you define a final class?
- Why would you define a final method?
- Why would you define an abstract method?
- What do we mean by “event-driven programs”?
- What is the relationship between the AWT library and the Swing library?
- What does a layout manager do?
- Describe the behavior of the FlowLayout manager, and the BorderLayout manager.
- How Radio buttons differ from regular buttons? How are they the same?
- What are “decorations”?
- 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);
- What will be displayed when the following statement is executed?
JOptionPane.showMessageDialog(null, "Incorrect data type", "Warning",
JOptionPane.WARNING_MESSAGE);
- Give the code to add the JList object addressList to a scroll pane named scrollPane.
- What is a “mnemonic”?
- 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];
- What does the following statement do?
JTextArea textField = JTextArea(message, 25, 15);
- Assuming myTextField references a JTextField object, what will be the results of executing the following statements?
myTextField.setEditable(true);
myTextField.setText("Tiny Tim");