2403 Java Exam 3
A/An ________ can change the length while the program is running.
ArrayList
Inner and outer classes do not have access to each other's private members.
False
Java does not come with a LinkedList library class.
False
The Type parameter is always indicated as a T.
False
When using a linked list, you do not need to know when the end of the list has been reached.
False
You can plug in a primitive type for a type parameter.
False
You can use any primitive type as the base type of an ArrayList class.
False
The ________ manager is the simplest layout manager. It arranges components one after the other, going from left to right, in the order in which you add them.
FlowLayout
The ________ manager arranges components in a two-dimensional table with some number of rows and columns.
GridLayout
Composition indicates a/an ________ relationship.
Has-a
An iterator is any object that allows you to step through the list one item at a time.
True
ArrayList objects do not have the array square-bracket notation.
True
Forgetting to set the reference instance variable of the last node in a linked list to null will cause a logic error.
True
Linked lists introduce the possibility of a privacy leak occurring.
True
The definition of a parameterized class is a class with one or more type parameters.
True
You can not use the set method to put an element at just any index.
True
The Java standard libraries have a class named ________ that behaves almost exactly the same as the class ArrayList.
Vector
A class that implements an interface but only gives definitions for some of the method headings given in the interface is called a/an:
abstract class.
A Java interface is an example of:
abstraction
A button fires events know as:
action events.
The ActionListener interface requires that the method ________ be implemented.
actionPerformed()
To place an element in an ArrayList position for the first time, you usually use the method:
add()
Java contains a mechanism that automatically reclaims memory. This mechanism is called:
garbage collection
Class and method definitions that include parameters for types are called:
generics
A ________ maps a data value such as a String into a number:
hash function
A common use of inner classes is:
helper
Standard layout managers are defined in the ________ package.
java.awt
The Comparable interface is in the ________ package.
java.lang
To use the Java Iterator Interface you must import the ________ package.
java.util
To use the Java class ArrayList, you must import the package:
java.util
All of the following are methods of the ArrayList class except:
length()
A button component should have a registered ________ associated with it.
listener
The method that must be implemented in a class using the Comparable interface is:
public int compareTo(Object other).
Which is the correct syntax for placing the string "boat" into an ArrayList name recVehicles in position 3 for the first time?
recVehicles.add(3, "boat");
All of the following are methods of the ArrayList class except:
resize()
A ________ copy of an object is a copy that has references in common with the original object.
shallow copy
When using ArrayLists the method ________ can be used to save memory:
trimToSize()
A class that uses an interface must use the keyword:
Implements
A class obtained from a generic class by plugging in a type for the type parameter is said to ________ the generic class.
Instantiate
Inheritance indicates a/an ________ relationship.
Is-a
An interface and all of its method headings are normally declared to be:
public
Any constant variables defined in an interface must be defined as:
public
When defining an inner class to be a helper class for an outer class, the inner classes access should be marked as:
Private
The remove(Object theElement) method of the ArrayList class returns:
Boolean
The ________ manager places components into five regions.
BorderLayout
A node contains:
Both data item(s) and reference(s) to another node
A queue is a last-in/first-out structure.
False
When using the clone method from an inherited base class you should account for a ________ exception.
CloneNotSupportedException
An interface specifies the headings and definitions for methods that must be defined in any class that implements the interface.
False
A programming style that uses a signal and response approach to programming is called:
Event-driven Programming.
The keyword ________ can be used to place a bound on a type parameter.
Extends
A deep copy of an object is a copy that has references in common with the original object.
False
A menu item is an object of the class:
JMenuItem
A ________ is an object that is a simple container class that groups other objects.
JPanel
A ________ allows multiple lines of text to be displayed.
JTextArea
A common exception that occurs when using linked lists is the:
NullPointerException
In Java, a node is a/an:
Object
Inner classes available outside the scope of their outer class are modified by the keyword:
Public
If an inner class contains non static members, then the class name must be modified by the keyword:
Static
The getText() method of a JTextField object returns an object of type:
String
A class definition can have more than one type parameter.
True
A copy constructor and a clone method should normally make a deep copy whenever possible.
True
A linked data structure contains nodes and links.
True
The compareTo method should return ________ if the calling object equals the parameter.
Zero
The JFrame method setVisible() takes one argument of type:
boolean.
An interface may contain:
constant variables.
A ________ copy of an object is a copy that has no references in common with the original object.
deep copy
A ________ linked list has nodes that contain two references to Nodes.
doubly
If the head instance variable of a linked list contains a reference to null, this means the list is:
empty
Making the Node class a private inner class of a linked data structure is an example of:
encapsulation
In Java, you indicate the end of a linked list be setting the link instance variable of the last node in the linked list to:
null
In Java, a derived class can have ________ base class(es).
one
A ________ is the smallest unit of space on which your screen can write.
pixel