Deck 11: Classes Continued

Full screen (f)
exit full mode
Question
If a class implements an interface, all its subclasses do so implicitly.
Use Space or
up arrow
down arrow
to flip the card.
Question
Characteristics common to several classes can be collected in a common abstract subclass. ____________________
Question
A class variable belongs to an object and is allocated storage when the object is created.
Question
Interfaces can be organized in an inheritance hierarchy.
Question
Classes that are related by inheritance have a has-a relationship. ____________________
Question
When you declare a variable, it should have a different interface name from the type name.
Question
An abstract class is one that will not be instantiated. ____________________
Question
Class methods can reference only instance variables, never static variables.
Question
It is easier to maintain a program that uses interface types.
Question
A Java ____ specifies the set of methods available to clients of a class.

A) interface
B) alias
C) variable
D) exception
Question
The methods in an interface are usually private. ____________________
Question
____ is when methods in different classes with a similar function are given the same name.

A) Aliasing
B) Inheritance
C) Polymorphism
D) Referencing
Question
The value of a class constant is assigned ____.

A) during execution
B) based on user input
C) based on inheritance
D) when the variable is declared
Question
A class can implement methods in addition to those listed in the interface.
Question
An interface is a class.
Question
A subclass often has methods that do not appear in its superclass.
Question
A class method is activated when a message is sent to the class rather than the object. ____________________
Question
____ provides a mechanism for reusing code and can reduce the effort required to implement a new class.

A) Aliasing
B) Inheritance
C) Polymorphism
D) Referencing
Question
In general, a static variable is used in any situation in which all instances share a common data value.
Question
In the TurtleGraphics package, the pen is initially all of the following EXCEPT ____.

A) at position [0,0]
B) ready to draw a square
C) pointing north
D) in the down position
Question
To compare objects for equality, use the ____.

A) = = operator
B) equals method
C) compare operator
D) both a and b are true.
Question
The class immediately above another is called its ____.

A) superclass
B) subclass
C) descendent
D) root
Question
The most general type of array is one whose element type is ____.

A) String
B) Object
C) Shape
D) Int
Question
____ a variable to a type that conflicts with its true identity leads to a run-time error.

A) Defining
B) Assigning
C) Declaring
D) Casting
Question
In Java, all classes are part of an immense hierarchy, with the class ____________________ at the root.
Question
A(n) ____________________ class is one that will be instantiated.
Question
FIGURE 11-1 <strong>FIGURE 11-1   Alec suggests that Amara create documentation for her program by embedding comments using the ____ symbol.</strong> A) < B) @ C) { D) /** <div style=padding-top: 35px>
Alec suggests that Amara create documentation for her program by embedding comments using the ____ symbol.

A) <
B) @
C) {
D) /**
Question
A(n) ____ method is accessible to a class's descendents, but not to any other classes in the hierarchy.

A) protected
B) private
C) dependent
D) inherited
Question
FIGURE 11-1 <strong>FIGURE 11-1   In Figure 11-1 above, we say that AAA ____ Object.</strong> A) aliases B) extends C) aggregates D) overrides <div style=padding-top: 35px>
In Figure 11-1 above, we say that AAA ____ Object.

A) aliases
B) extends
C) aggregates
D) overrides
Question
When information needs to be shared among all instances of a class, that information can be represented in terms of ____________________ variables.
Question
When the element type of an array is a(n) ____ or interface, objects of those types or any subtype can be directly inserted into the array.

A) primitive
B) concrete
C) abstract
D) reference
Question
A class's ____ provides the information needed to use the class without revealing anything about its implementation..

A) value
B) definition
C) interface
D) hierarchy
Question
One way to enforce preconditions is to ____.

A) use comments
B) declare them
C) use inheritance
D) throw an exception
Question
The relationship that allows an object of one class to send a message to an object of another class is called ____.

A) inheritance
B) superclass
C) dependency
D) aggregation
Question
A(n) ____________________ method cannot be overridden by a subclass.
Question
Methods in a subclass can be related to methods in a superclass in all of the following ways EXCEPT ____.

A) implementation of a concrete method.
B) extension
C) overriding
D) finality
Question
FIGURE 11-1 <strong>FIGURE 11-1   Figure 11-1 above shows an example of a ____ hierarchy.</strong> A) class B) interface C) program D) method <div style=padding-top: 35px>
Figure 11-1 above shows an example of a ____ hierarchy.

A) class
B) interface
C) program
D) method
Question
The ____ process uses the clone message to obtain copies.

A) duplication
B) deep copying
C) aliasing
D) overriding
Question
When related classes have the same ____, they can be used interchangeably in a program.

A) value
B) definition
C) interface
D) hierarchy
Question
If more than one class implements an interface, its methods are ____.

A) aggregated
B) public
C) dependent
D) polymorphic
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When an object of one class contains objects of another class as structural components.
Question
A method's ____________________ describe what should be true before it is called.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When objects are related by sending and receiving a message.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When the subclass method does not exist in the superclass.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When the subclass method is intended as a replacement of the superclass method.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When an object's class is a subclass of a more general class.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/46
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 11: Classes Continued
1
If a class implements an interface, all its subclasses do so implicitly.
True
2
Characteristics common to several classes can be collected in a common abstract subclass. ____________________
False
3
A class variable belongs to an object and is allocated storage when the object is created.
False
4
Interfaces can be organized in an inheritance hierarchy.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
5
Classes that are related by inheritance have a has-a relationship. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
6
When you declare a variable, it should have a different interface name from the type name.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
7
An abstract class is one that will not be instantiated. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
8
Class methods can reference only instance variables, never static variables.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
9
It is easier to maintain a program that uses interface types.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
10
A Java ____ specifies the set of methods available to clients of a class.

A) interface
B) alias
C) variable
D) exception
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
11
The methods in an interface are usually private. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
12
____ is when methods in different classes with a similar function are given the same name.

A) Aliasing
B) Inheritance
C) Polymorphism
D) Referencing
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
13
The value of a class constant is assigned ____.

A) during execution
B) based on user input
C) based on inheritance
D) when the variable is declared
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
14
A class can implement methods in addition to those listed in the interface.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
15
An interface is a class.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
16
A subclass often has methods that do not appear in its superclass.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
17
A class method is activated when a message is sent to the class rather than the object. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
18
____ provides a mechanism for reusing code and can reduce the effort required to implement a new class.

A) Aliasing
B) Inheritance
C) Polymorphism
D) Referencing
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
19
In general, a static variable is used in any situation in which all instances share a common data value.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
20
In the TurtleGraphics package, the pen is initially all of the following EXCEPT ____.

A) at position [0,0]
B) ready to draw a square
C) pointing north
D) in the down position
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
21
To compare objects for equality, use the ____.

A) = = operator
B) equals method
C) compare operator
D) both a and b are true.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
22
The class immediately above another is called its ____.

A) superclass
B) subclass
C) descendent
D) root
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
23
The most general type of array is one whose element type is ____.

A) String
B) Object
C) Shape
D) Int
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
24
____ a variable to a type that conflicts with its true identity leads to a run-time error.

A) Defining
B) Assigning
C) Declaring
D) Casting
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
25
In Java, all classes are part of an immense hierarchy, with the class ____________________ at the root.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
26
A(n) ____________________ class is one that will be instantiated.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
27
FIGURE 11-1 <strong>FIGURE 11-1   Alec suggests that Amara create documentation for her program by embedding comments using the ____ symbol.</strong> A) < B) @ C) { D) /**
Alec suggests that Amara create documentation for her program by embedding comments using the ____ symbol.

A) <
B) @
C) {
D) /**
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
28
A(n) ____ method is accessible to a class's descendents, but not to any other classes in the hierarchy.

A) protected
B) private
C) dependent
D) inherited
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
29
FIGURE 11-1 <strong>FIGURE 11-1   In Figure 11-1 above, we say that AAA ____ Object.</strong> A) aliases B) extends C) aggregates D) overrides
In Figure 11-1 above, we say that AAA ____ Object.

A) aliases
B) extends
C) aggregates
D) overrides
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
30
When information needs to be shared among all instances of a class, that information can be represented in terms of ____________________ variables.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
31
When the element type of an array is a(n) ____ or interface, objects of those types or any subtype can be directly inserted into the array.

A) primitive
B) concrete
C) abstract
D) reference
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
32
A class's ____ provides the information needed to use the class without revealing anything about its implementation..

A) value
B) definition
C) interface
D) hierarchy
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
33
One way to enforce preconditions is to ____.

A) use comments
B) declare them
C) use inheritance
D) throw an exception
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
34
The relationship that allows an object of one class to send a message to an object of another class is called ____.

A) inheritance
B) superclass
C) dependency
D) aggregation
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
35
A(n) ____________________ method cannot be overridden by a subclass.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
36
Methods in a subclass can be related to methods in a superclass in all of the following ways EXCEPT ____.

A) implementation of a concrete method.
B) extension
C) overriding
D) finality
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
37
FIGURE 11-1 <strong>FIGURE 11-1   Figure 11-1 above shows an example of a ____ hierarchy.</strong> A) class B) interface C) program D) method
Figure 11-1 above shows an example of a ____ hierarchy.

A) class
B) interface
C) program
D) method
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
38
The ____ process uses the clone message to obtain copies.

A) duplication
B) deep copying
C) aliasing
D) overriding
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
39
When related classes have the same ____, they can be used interchangeably in a program.

A) value
B) definition
C) interface
D) hierarchy
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
40
If more than one class implements an interface, its methods are ____.

A) aggregated
B) public
C) dependent
D) polymorphic
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
41
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When an object of one class contains objects of another class as structural components.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
42
A method's ____________________ describe what should be true before it is called.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
43
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When objects are related by sending and receiving a message.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
44
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When the subclass method does not exist in the superclass.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
45
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When the subclass method is intended as a replacement of the superclass method.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
46
Identify the letter of the choice that best matches the phrase or definition.
a.Dependency
b.Extension
c.Overriding
d.Aggregation
e.Inheritance
When an object's class is a subclass of a more general class.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 46 flashcards in this deck.