Deck 12: Object-Oriented Design
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/104
Play
Full screen (f)
Deck 12: Object-Oriented Design
1
Why is it generally considered good practice to minimize coupling between classes?
A) Low coupling increases the operational efficiency of a program.
B) High coupling implies less interface cohesion.
C) High coupling increases program maintenance and hinders code reuse.
D) Low coupling decreases the probability of code redundancy.
A) Low coupling increases the operational efficiency of a program.
B) High coupling implies less interface cohesion.
C) High coupling increases program maintenance and hinders code reuse.
D) Low coupling decreases the probability of code redundancy.
C
2
When using the CRC method, other classes that are needed to fulfill the responsibilities of a given class are called its ____.
A) Related classes.
B) Responsible classes.
C) Collaborators.
D) Concurrent classes.
A) Related classes.
B) Responsible classes.
C) Collaborators.
D) Concurrent classes.
C
3
Dependency between classes denotes that ____.
A) Objects of one class inherit from objects of its superclass.
B) Objects of one class can be inherited by its subclasses.
C) Objects of one class implement an interface.
D) Methods in the objects of one class use an object of another class.
A) Objects of one class inherit from objects of its superclass.
B) Objects of one class can be inherited by its subclasses.
C) Objects of one class implement an interface.
D) Methods in the objects of one class use an object of another class.
D
4
A class (ClassOne) is considered to have a dependency on another class (ClassTwo) under which of the following conditions?
A) Each class uses objects of the other.
B) The public interfaces of both classes are cohesive.
C) ClassTwo uses objects of ClassOne.
D) ClassOne uses objects of ClassTwo.
A) Each class uses objects of the other.
B) The public interfaces of both classes are cohesive.
C) ClassTwo uses objects of ClassOne.
D) ClassOne uses objects of ClassTwo.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
5
A CRC card describes ____.
A) A class, its responsibilities, and its collaborating classes.
B) A class, its methods, and its constructors.
C) A class, its relationships, and its collaborating classes.
D) A class, its requirements, and its concurrent classes.
A) A class, its responsibilities, and its collaborating classes.
B) A class, its methods, and its constructors.
C) A class, its relationships, and its collaborating classes.
D) A class, its requirements, and its concurrent classes.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following would be an appropriate name for a game-related class?
A) FinalizeLevelOne
B) InitialLevel
C) ResetTheCurrentLevel
D) AscendToFinalLevel
A) FinalizeLevelOne
B) InitialLevel
C) ResetTheCurrentLevel
D) AscendToFinalLevel
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
7
In a UML diagram, dependency is denoted by ____.
A) A dotted/dashed line with a closed arrow tip.
B) A solid line with a closed arrow tip.
C) A dotted/dashed line with an open arrow tip.
D) A solid line with an open arrow tip.
A) A dotted/dashed line with a closed arrow tip.
B) A solid line with a closed arrow tip.
C) A dotted/dashed line with an open arrow tip.
D) A solid line with an open arrow tip.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following questions should you ask yourself in order to determine if you have named your class properly?
A) Does the class name contain 8 or fewer characters?
B) Is the class name a verb?
C) Can I visualize an object of the class?
D) Does the class name describe the tasks that this class will accomplish?
A) Does the class name contain 8 or fewer characters?
B) Is the class name a verb?
C) Can I visualize an object of the class?
D) Does the class name describe the tasks that this class will accomplish?
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
9
You are designing an application to support an automobile rental agency. Which of the following probably should NOT be represented as an object?
A) Auto
B) Customer
C) Payment amount
D) Rental contract
A) Auto
B) Customer
C) Payment amount
D) Rental contract
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
10
Classes often correspond to ____ in a requirements description.
A) Verbs
B) Nouns
C) Dependencies
D) Relationships
A) Verbs
B) Nouns
C) Dependencies
D) Relationships
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
11
Under which of the following conditions would the public interface of a class be considered cohesive?
A) All of its features are public and none of its features are static.
B) The quality of the public interface is rated as moderate to high.
C) All of its features are related to the concept that the class represents.
D) It is obvious that the public interface refers to multiple concepts.
A) All of its features are public and none of its features are static.
B) The quality of the public interface is rated as moderate to high.
C) All of its features are related to the concept that the class represents.
D) It is obvious that the public interface refers to multiple concepts.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following most likely indicates that you have chosen a good name for your class?
A) The name consists of a single word.
B) You can tell by the name what an object of the class is supposed to represent.
C) You can easily determine by the name how many concepts the class represents.
D) The name describes what task the class will perform.
A) The name consists of a single word.
B) You can tell by the name what an object of the class is supposed to represent.
C) You can easily determine by the name how many concepts the class represents.
D) The name describes what task the class will perform.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following would be an appropriate name for a class used in an inventory application?
A) Product
B) InitializeInventoryLevel
C) ResetCurrentInventoryLevel
D) ReceiveNewProducts
A) Product
B) InitializeInventoryLevel
C) ResetCurrentInventoryLevel
D) ReceiveNewProducts
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
14
You are designing an application to support a veterinary clinic. Which of the following probably should NOT be represented as an object?
A) Pet
B) Customer
C) Medical service performed
D) Drug dosage
A) Pet
B) Customer
C) Medical service performed
D) Drug dosage
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
15
After you have identified a set of classes needed for a program, you should now ____.
A) Define the behavior of each class.
B) Look for nouns that describe the tasks.
C) Begin writing the code for the classes.
D) Establish the relationships between the classes.
A) Define the behavior of each class.
B) Look for nouns that describe the tasks.
C) Begin writing the code for the classes.
D) Establish the relationships between the classes.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
16
A UML class diagram would be most useful in visually illustrating which of the following?
A) the cohesiveness of a class's interface.
B) the amount of complexity of a class's interface.
C) dependencies between classes.
D) relationships between classes and their interfaces.
A) the cohesiveness of a class's interface.
B) the amount of complexity of a class's interface.
C) dependencies between classes.
D) relationships between classes and their interfaces.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following is the most important consideration when designing a class?
A) Each class should represent an appropriate mathematical concept.
B) Each class should represent a single concept or object from the problem domain.
C) Each class should represent no more than three specific concepts.
D) Each class should represent multiple concepts only if they are closely related.
A) Each class should represent an appropriate mathematical concept.
B) Each class should represent a single concept or object from the problem domain.
C) Each class should represent no more than three specific concepts.
D) Each class should represent multiple concepts only if they are closely related.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
18
A/an ____ represents a set of objects with the same behavior.
A) Association
B) Aggregation
C) Dependency
D) Class
A) Association
B) Aggregation
C) Dependency
D) Class
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
19
If many classes of a program depend on each other, we say that ____.
A) cohesiveness is high.
B) cohesiveness is low.
C) coupling is high.
D) coupling is low.
A) cohesiveness is high.
B) cohesiveness is low.
C) coupling is high.
D) coupling is low.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
20
When using the CRC method, if you determine that a class cannot carry out a particular task by itself and needs the help of another class to complete the task, you should ____.
A) Do nothing on this class's CRC card. The task will be shown on the other class's CRC card.
B) Add this class onto the other class's CRC card as a collaborator.
C) Add the other class onto this class's CRC card as a collaborator.
D) Add each class onto the other class's CRC card as a collaborator.
A) Do nothing on this class's CRC card. The task will be shown on the other class's CRC card.
B) Add this class onto the other class's CRC card as a collaborator.
C) Add the other class onto this class's CRC card as a collaborator.
D) Add each class onto the other class's CRC card as a collaborator.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
21
____ is often described as the has-a relationship.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Dependency.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Dependency.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
22
Which statement correctly describes the class relationship shown in this diagram? 
A) Quiz class depends on Question class
B) Question class aggregates Quiz class
C) Quiz class aggregates Question class.
D) Question class inherits from Quiz class.

A) Quiz class depends on Question class
B) Question class aggregates Quiz class
C) Quiz class aggregates Question class.
D) Question class inherits from Quiz class.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
23
UML means____.
A) Unified Mode Language
B) User Modeling Language
C) User Mode Language.
D) Unified Modeling Language.
A) Unified Mode Language
B) User Modeling Language
C) User Mode Language.
D) Unified Modeling Language.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following code snippets denotes that the Fleet class aggregates the Taxi class?
A) public class Fleet extends Taxi
B) public class Taxi extends Fleet
C) public class Fleet
{
Private ArrayList taxicabs;
}
D) public class Taxi
{
Private Fleet myFleet;
}
A) public class Fleet extends Taxi
B) public class Taxi extends Fleet
C) public class Fleet
{
Private ArrayList
}
D) public class Taxi
{
Private Fleet myFleet;
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
25
Consider the following code snippet: public class Motorcycle
{
Private Tire[] tires;
) . .
}
Which of the following statements correctly describes the relationship between the Motorcycle and Tire classes?
A) Motorcycle exhibits the has-a relationship with regards to Tire.
B) Motorcycle exhibits the is-a relationship with regard to Tire.
C) Tire exhibits the has-a relationship with regards to Motorcycle.
D) Tire exhibits the is-a relationship with regards to Motorcycle.
{
Private Tire[] tires;
) . .
}
Which of the following statements correctly describes the relationship between the Motorcycle and Tire classes?
A) Motorcycle exhibits the has-a relationship with regards to Tire.
B) Motorcycle exhibits the is-a relationship with regard to Tire.
C) Tire exhibits the has-a relationship with regards to Motorcycle.
D) Tire exhibits the is-a relationship with regards to Motorcycle.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
26
A CashRegister class contains an array list of Coin objects. This is best described as an example of ____.
A) Association
B) Inheritance
C) Cohesiveness
D) Aggregation
A) Association
B) Inheritance
C) Cohesiveness
D) Aggregation
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
27
Consider the following code snippet: public class Motorcycle
{
Private Tire[] tires;
) . .
}
This code is best described as an example of ____.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Association.
{
Private Tire[] tires;
) . .
}
This code is best described as an example of ____.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Association.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
28
Consider the following code snippet: public class Purse
{
Private Coin[] coins;
) . .
}
Which of the following statements is correct?
A) Purse aggregates Coin.
B) Coin depends on Purse.
C) The Coin class must be declared as an inner class within Purse.
D) Coin inherits from Purse.
{
Private Coin[] coins;
) . .
}
Which of the following statements is correct?
A) Purse aggregates Coin.
B) Coin depends on Purse.
C) The Coin class must be declared as an inner class within Purse.
D) Coin inherits from Purse.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
29
Which statement correctly describes the class relationship shown in this diagram? 
A) CashRegister class depends on Coin class
B) Coin class depends on CashRegister class
C) CashRegister class aggregates Coin class.
D) Coin class inherits from CashRegister class.

A) CashRegister class depends on Coin class
B) Coin class depends on CashRegister class
C) CashRegister class aggregates Coin class.
D) Coin class inherits from CashRegister class.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
30
Which of the following code snippets denotes that the Kitchen class depends on the Stove class?
A) public class Kitchen extends Stove
B) public class Stove
{
Private Kitchen[] kitchens;
}
C) public class Kitchen
{
Private Stove aStove;
}
D) public class Kitchen implements Stove
A) public class Kitchen extends Stove
B) public class Stove
{
Private Kitchen[] kitchens;
}
C) public class Kitchen
{
Private Stove aStove;
}
D) public class Kitchen implements Stove
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
31
The dependency relationship is sometimes referred to as the ____ relationship.
A) is-a
B) has-a
C) depends-on
D) knows-about
A) is-a
B) has-a
C) depends-on
D) knows-about
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
32
In a UML diagram, aggregation is denoted by ____.
A) A solid line with a diamond-shaped symbol next to the aggregating class.
B) An arrow with an open triangle pointing to the aggregating class.
C) A dotted line with a diamond-shaped symbol next to the aggregating class.
D) A dotted line with an open arrow tip pointing to the aggregating class.
A) A solid line with a diamond-shaped symbol next to the aggregating class.
B) An arrow with an open triangle pointing to the aggregating class.
C) A dotted line with a diamond-shaped symbol next to the aggregating class.
D) A dotted line with an open arrow tip pointing to the aggregating class.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following code snippets denotes that the Kitchen class aggregates the Dish class?
A) public class Kitchen extends Dish
B) public class Dish extends Kitchen
C) public class Kitchen
{
Private Dish[] dishes;
}
D) public class Dish
{
Private Kitchen myKitchen;
}
A) public class Kitchen extends Dish
B) public class Dish extends Kitchen
C) public class Kitchen
{
Private Dish[] dishes;
}
D) public class Dish
{
Private Kitchen myKitchen;
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
34
Aggregation denotes that ____.
A) Objects of one class inherit from objects of its superclass.
B) Objects of one class can be inherited by its subclasses.
C) Objects of one class contain references to objects of its superclass.
D) Objects of one class contain references to objects of another class.
A) Objects of one class inherit from objects of its superclass.
B) Objects of one class can be inherited by its subclasses.
C) Objects of one class contain references to objects of its superclass.
D) Objects of one class contain references to objects of another class.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
35
Which of the following statements is correct?
A) Dependency is a stronger form of aggregation.
B) Aggregation indicates high cohesiveness.
C) Aggregation indicates low coupling.
D) Aggregation is a stronger form of dependency.
A) Dependency is a stronger form of aggregation.
B) Aggregation indicates high cohesiveness.
C) Aggregation indicates low coupling.
D) Aggregation is a stronger form of dependency.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following code snippets denotes that the Purse class depends on the Wallet class?
A) public class Purse extends Wallet
B) public class Wallet extends Purse
C) public class Wallet
{
Private Purse aPurse;
}
D) public class Purse
{
Private Wallet aWallet;
}
A) public class Purse extends Wallet
B) public class Wallet extends Purse
C) public class Wallet
{
Private Purse aPurse;
}
D) public class Purse
{
Private Wallet aWallet;
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
37
Which of the following code snippets denotes that the Pen class depends on the Ink class?
A) public class Pen extends Ink
B) public class Ink extends Pen
C) public class Pen
{
Private Ink anInk;
}
D) public class Ink
{
Private Pen aPen;
}
A) public class Pen extends Ink
B) public class Ink extends Pen
C) public class Pen
{
Private Ink anInk;
}
D) public class Ink
{
Private Pen aPen;
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
38
In general, you need ____ when an object needs to remember another object between method calls.
A) inheritance
B) aggregation
C) association
D) an interface implementation
A) inheritance
B) aggregation
C) association
D) an interface implementation
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
39
A Quiz class contains an array of Question objects. This is best described as an example of ____.
A) Aggregation
B) Cohesiveness
C) Association
D) Inheritance
A) Aggregation
B) Cohesiveness
C) Association
D) Inheritance
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
40
Consider the following code snippet: public class Purse
{
Private Coin[] coins;
) . .
}
This code is best described as an example of ____.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Association.
{
Private Coin[] coins;
) . .
}
This code is best described as an example of ____.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Association.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
41
Which statement correctly describes the class relationship shown in this diagram? 
A) Tire class aggregates Car class.
B) Car class aggregates Tire class.
C) Car class inherits from Tire class.
D) Tire class inherits from Car class.

A) Tire class aggregates Car class.
B) Car class aggregates Tire class.
C) Car class inherits from Tire class.
D) Tire class inherits from Car class.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
42
Consider the following code snippet: public class SailBoat extends Vessel
{ ) . . }
Public class Catamaran extends SailBoat
{ ) . . }
Which of the following statements is NOT correct?
A) SailBoat inherits from Vessel.
B) Catamaran inherits from Vessel.
C) Catamaran inherits from Sailboat.
D) Catamaran depends on SailBoat.
{ ) . . }
Public class Catamaran extends SailBoat
{ ) . . }
Which of the following statements is NOT correct?
A) SailBoat inherits from Vessel.
B) Catamaran inherits from Vessel.
C) Catamaran inherits from Sailboat.
D) Catamaran depends on SailBoat.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
43
Which statement correctly describes the class relationship shown in this diagram? 
A) Vehicle class depends on Car class
B) Car class depends on Vehicle class
C) Vehicle class inherits from Car class.
D) Car class inherits from Vehicle class.

A) Vehicle class depends on Car class
B) Car class depends on Vehicle class
C) Vehicle class inherits from Car class.
D) Car class inherits from Vehicle class.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
44
____ is often described as the is-a relationship.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Dependency.
A) Inheritance.
B) Aggregation.
C) Polymorphism.
D) Dependency.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
45
Consider the following code snippet: public class SailBoat extends Vessel
{
Private Engine[] engines;
Private Sail mainsail;
) . .
}
Which of the following statements is NOT correct?
A) SailBoat inherits from Vessel.
B) Sail depends on Sailboat.
C) Sailboat aggregates Engine.
D) SailBoat aggregates Sail.
{
Private Engine[] engines;
Private Sail mainsail;
) . .
}
Which of the following statements is NOT correct?
A) SailBoat inherits from Vessel.
B) Sail depends on Sailboat.
C) Sailboat aggregates Engine.
D) SailBoat aggregates Sail.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
46
Consider the following code snippet: public class Motorcycle extends Vehicle
{
Private Tire[] tires;
) . .
}
This code is best described as an example of ____.
A) Inheritance and multiplicities.
B) Aggregation and dependency.
C) Inheritance and aggregation.
D) Inheritance and association.
{
Private Tire[] tires;
) . .
}
This code is best described as an example of ____.
A) Inheritance and multiplicities.
B) Aggregation and dependency.
C) Inheritance and aggregation.
D) Inheritance and association.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
47
You have determined a need for a Book class and a Page class in your program. Which relationship is most appropriate between these classes?
A) Inheritance
B) Aggregation
C) Dependency
D) Interface implementation
A) Inheritance
B) Aggregation
C) Dependency
D) Interface implementation
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
48
Consider the following code snippet: public class Manager extends Employee
{
Private Project[] projects;
Private Address address;
) . .
}
Which of the following statements is NOT correct?
A) Manager inherits from Employee.
B) Address aggregates Manager.
C) Manager aggregates Address.
D) Manager aggregates Project.
{
Private Project[] projects;
Private Address address;
) . .
}
Which of the following statements is NOT correct?
A) Manager inherits from Employee.
B) Address aggregates Manager.
C) Manager aggregates Address.
D) Manager aggregates Project.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
49
Consider the following code snippet: public class PowerBoat extends Vessel
{
Private Engine[] engines;
) . .
}
This code is best described as an example of ____.
A) Inheritance and multiplicities.
B) Aggregation and association.
C) Inheritance and aggregation.
D) Inheritance and dependency.
{
Private Engine[] engines;
) . .
}
This code is best described as an example of ____.
A) Inheritance and multiplicities.
B) Aggregation and association.
C) Inheritance and aggregation.
D) Inheritance and dependency.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
50
Which of the followings statements about class relationships is correct?
A) Inheritance represents the is-a relationship, while aggregation represents the has-a relationship.
B) Inheritance represents the has-a relationship, while dependency represents the uses relationship.
C) Aggregation represents the is-a relationship, while inheritance represents the uses relationship.
D) Aggregation represents the has-a relationship, while dependence represents the is-a relationship.
A) Inheritance represents the is-a relationship, while aggregation represents the has-a relationship.
B) Inheritance represents the has-a relationship, while dependency represents the uses relationship.
C) Aggregation represents the is-a relationship, while inheritance represents the uses relationship.
D) Aggregation represents the has-a relationship, while dependence represents the is-a relationship.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
51
Which of the following code snippets denotes that the Lime class inherits from the Citrus class?
A) public class Lime extends Citrus
B) public class Citrus extends Lime
C) public class Lime
{
Private ArrayList fruits;
}
D) public class Citrus
{
Private ArrayList limes;
}
A) public class Lime extends Citrus
B) public class Citrus extends Lime
C) public class Lime
{
Private ArrayList
}
D) public class Citrus
{
Private ArrayList
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
52
Consider the following code snippet: public class Motorcycle extends Vehicle
{ ) . . }
Which of the following statements correctly describes the relationship between the Motorcycle and Vehicle classes?
A) Motorcycle exhibits the has-a relationship with regards to Vehicle.
B) Motorcycle exhibits the is-a relationship with regard to Vehicle.
C) Vehicle exhibits the has-a relationship with regards to Motorcycle.
D) Vehicle exhibits the is-a relationship with regards to Motorcycle.
{ ) . . }
Which of the following statements correctly describes the relationship between the Motorcycle and Vehicle classes?
A) Motorcycle exhibits the has-a relationship with regards to Vehicle.
B) Motorcycle exhibits the is-a relationship with regard to Vehicle.
C) Vehicle exhibits the has-a relationship with regards to Motorcycle.
D) Vehicle exhibits the is-a relationship with regards to Motorcycle.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
53
In a UML diagram, the relationship symbol shown below denotes ____. 
A) inheritance
B) aggregation
C) dependency
D) interface implementation

A) inheritance
B) aggregation
C) dependency
D) interface implementation
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
54
In a UML diagram, the relationship symbol shown below denotes ____. 
A) inheritance
B) aggregation
C) dependency
D) interface implementation

A) inheritance
B) aggregation
C) dependency
D) interface implementation
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
55
When designing classes, if you find classes with common behavior you should ____.
A) Combine them all into a single class.
B) Place the common behavior into a superclass.
C) Place the common behavior into a subclass.
D) Give them similar names.
A) Combine them all into a single class.
B) Place the common behavior into a superclass.
C) Place the common behavior into a subclass.
D) Give them similar names.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
56
In a UML diagram, inheritance is denoted by ____.
A) A solid line with a diamond-shaped symbol next to the superclass.
B) A solid line with a closed arrow tip pointing to the superclass.
C) A dotted line with an open arrow tip pointing to the superclass.
D) A solid line with an open arrow tip pointing to the superclass.
A) A solid line with a diamond-shaped symbol next to the superclass.
B) A solid line with a closed arrow tip pointing to the superclass.
C) A dotted line with an open arrow tip pointing to the superclass.
D) A solid line with an open arrow tip pointing to the superclass.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
57
In a UML diagram, an interface implementation is denoted by ____.
A) A dotted line with a closed arrow tip.
B) A solid line with a closed arrow tip.
C) A dotted line with an open arrow tip.
D) A solid line with an open arrow tip.
A) A dotted line with a closed arrow tip.
B) A solid line with a closed arrow tip.
C) A dotted line with an open arrow tip.
D) A solid line with an open arrow tip.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
58
Which of the following code snippets denotes that the Rose class inherits from the Flower class?
A) public class Flower extends Rose
B) public class Rose extends Flower
C) public class Rose
{
Private Flower[] flowers;
}
D) public class Flower
{
Private Rose[] limes;
}
A) public class Flower extends Rose
B) public class Rose extends Flower
C) public class Rose
{
Private Flower[] flowers;
}
D) public class Flower
{
Private Rose[] limes;
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
59
Consider the following code snippet: public class Motorcycle extends Vehicle
{
Private Tire[] tires;
Private Engine anEngine;
) . .
}
Which of the following statements describing relationships between the Motorcycle, Tire, Engine and Vehicle classes is NOT correct?
A) Motorcycle exhibits the has-a relationship with regards to Tire.
B) Motorcycle exhibits the is-a relationship with regard to Vehicle.
C) Vehicle exhibits the has-a relationship with regards to Motorcycle.
D) Motorcycle exhibits the knows-about relationship with regards to Engine.
{
Private Tire[] tires;
Private Engine anEngine;
) . .
}
Which of the following statements describing relationships between the Motorcycle, Tire, Engine and Vehicle classes is NOT correct?
A) Motorcycle exhibits the has-a relationship with regards to Tire.
B) Motorcycle exhibits the is-a relationship with regard to Vehicle.
C) Vehicle exhibits the has-a relationship with regards to Motorcycle.
D) Motorcycle exhibits the knows-about relationship with regards to Engine.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
60
In a UML diagram, the relationship symbol shown below denotes ____. 
A) inheritance
B) aggregation
C) dependency
D) interface implementation

A) inheritance
B) aggregation
C) dependency
D) interface implementation
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
61
Which of the following statements about class attributes is true?
A) An attribute always corresponds to an instance variable of the class.
B) An attribute is an externally observable property that objects of the class have.
C) An attribute is used to represent aggregation with another class.
D) Attributes cannot be represented in UML diagrams.
A) An attribute always corresponds to an instance variable of the class.
B) An attribute is an externally observable property that objects of the class have.
C) An attribute is used to represent aggregation with another class.
D) Attributes cannot be represented in UML diagrams.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
62
How does a UML diagram denote a multiplicity of one or more in an aggregation relationship?
A) *
B) 1..*
C) *..1
D) 1..n
A) *
B) 1..*
C) *..1
D) 1..n
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
63
You have determined a need for an Employee class and a TemporaryEmployee class in your program. Which relationship is most appropriate between these classes?
A) Inheritance
B) Aggregation
C) Dependency
D) Interface implementation
A) Inheritance
B) Aggregation
C) Dependency
D) Interface implementation
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
64
When using CRC cards, UML diagrams should be created ___.
A) Prior to discovering classes.
B) After you have discovered classes and their relationships.
C) During the implementation phase.
D) To produce final documentation of the system.
A) Prior to discovering classes.
B) After you have discovered classes and their relationships.
C) During the implementation phase.
D) To produce final documentation of the system.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
65
You have determined the need for a File class and a Folder class in your program. Which of the following would best describe the relationship between these classes?
A) Aggregation
B) Association
C) Composition
D) Inheritance
A) Aggregation
B) Association
C) Composition
D) Inheritance
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
66
____ relationships come from the collaboration columns on the CRC cards.
A) Association
B) Inheritance
C) Dependency
D) Attribute
A) Association
B) Inheritance
C) Dependency
D) Attribute
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
67
Parallel arrays are ____.
A) Two or more arrays or array lists of the same length which each store a part of what could be considered an object.
B) Two or more arrays or array lists of the same length.
C) Two or more arrays or array lists of the same data type.
D) Two or more arrays or array lists that are declared one after the other in a program.
A) Two or more arrays or array lists of the same length which each store a part of what could be considered an object.
B) Two or more arrays or array lists of the same length.
C) Two or more arrays or array lists of the same data type.
D) Two or more arrays or array lists that are declared one after the other in a program.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
68
Which of the following statements about associations between classes is true?
A) A class is associated with another class if both classes are in the same package.
B) A class is associated with another class if the class inherits from the other class.
C) A class is associated with another class if the other class inherits from this class.
D) A class is associated with another class if you can navigate from objects of one class to objects of the other class.
A) A class is associated with another class if both classes are in the same package.
B) A class is associated with another class if the class inherits from the other class.
C) A class is associated with another class if the other class inherits from this class.
D) A class is associated with another class if you can navigate from objects of one class to objects of the other class.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
69
You are designing a software solution for an automobile rental company. You have decided that the following nouns apply to the requirements: Auto, Customer, Address, Rental Contract, Mileage, Rental Date, Daily Rate, Total. Which of these should be represented as classes?
A) All of them.
B) Auto, Customer, Address, Rental Contract.
C) Auto, Customer, Address, Rental Contract, Mileage.
D) Auto, Customer, Address, Rental Contract, Mileage, Rental Date, Daily Rate.
A) All of them.
B) Auto, Customer, Address, Rental Contract.
C) Auto, Customer, Address, Rental Contract, Mileage.
D) Auto, Customer, Address, Rental Contract, Mileage, Rental Date, Daily Rate.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
70
Select a code segment to complete the Player class, so that it reflects an inheritance relationship between Player and Person. public class Player ___________________________
A) extends Person
{
…
}
B) {
Private Person thePlayer;
…
}
C) implements Person
{
…
}
D) {
Private ArrayList players;
…
}
A) extends Person
{
…
}
B) {
Private Person thePlayer;
…
}
C) implements Person
{
…
}
D) {
Private ArrayList
…
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
71
Select a code segment to complete the SmartPhone class, so that it reflects an interface implementation relationship between SmartPhone and MP3Player. public class SmartPhone ___________________________
A) extends MP3Player
{
…
}
B) {
Private MP3Player musicPlayer;
…
}
C) implements MP3Player
{
…
}
D) implements interface MP3Player
{
…
}
A) extends MP3Player
{
…
}
B) {
Private MP3Player musicPlayer;
…
}
C) implements MP3Player
{
…
}
D) implements interface MP3Player
{
…
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
72
Select a code segment to complete the Name class, so that it reflects a dependency relationship between Name and String. public class Name ___________________________
A) extends String
{
…
}
B) {
Private String first;
Private String second;
…
}
C) implements String
{
…
}
D) {
Private ArrayList names;
…
}
A) extends String
{
…
}
B) {
Private String first;
Private String second;
…
}
C) implements String
{
…
}
D) {
Private ArrayList
…
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
73
Before you begin designing a solution, you should ____.
A) Document the methods that will be needed.
B) Gather and document all requirements for the program in plain English.
C) Determine the classes that will be needed.
D) Create the UML diagrams to represent the classes.
A) Document the methods that will be needed.
B) Gather and document all requirements for the program in plain English.
C) Determine the classes that will be needed.
D) Create the UML diagrams to represent the classes.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
74
How does a UML diagram denote classes and their attributes and methods?
A) A class rectangle contains the class name in the top, methods in the middle, and attributes in the bottom.
B) A class rectangle contains the class name in the top, attributes in the middle, and methods in the bottom.
C) A class rectangle contains the methods in the top, class name in the middle, and attributes in the bottom.
D) A class rectangle contains the attributes in the top, methods in the middle, and class name in the bottom.
A) A class rectangle contains the class name in the top, methods in the middle, and attributes in the bottom.
B) A class rectangle contains the class name in the top, attributes in the middle, and methods in the bottom.
C) A class rectangle contains the methods in the top, class name in the middle, and attributes in the bottom.
D) A class rectangle contains the attributes in the top, methods in the middle, and class name in the bottom.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
75
To improve the quality of the public interface of a class, ____.
A) You should maximize cohesion and minimize inheritance.
B) You should minimize cohesion and maximize coupling.
C) You should maximize cohesion and minimize coupling.
D) You should minimize cohesion and maximize aggregation.
A) You should maximize cohesion and minimize inheritance.
B) You should minimize cohesion and maximize coupling.
C) You should maximize cohesion and minimize coupling.
D) You should minimize cohesion and maximize aggregation.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
76
Given the following diagram:
What does this diagram indicate about the relationship between the customers and bank accounts?
A) A bank account may be owned by only one customer.
B) A bank account may be owned by one or more customers.
C) A customer may have only one bank account.
D) A customer may have one or more bank accounts.

A) A bank account may be owned by only one customer.
B) A bank account may be owned by one or more customers.
C) A customer may have only one bank account.
D) A customer may have one or more bank accounts.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
77
Select a code segment to complete the Team class, so that it reflects an aggregation relationship between Team and Player. public class Team ___________________________
A) extends Player
{
…
}
B) {
Private Player aPlayer;
…
}
C) implements Player
{
…
}
D) {
Private ArrayList players;
…
}
A) extends Player
{
…
}
B) {
Private Player aPlayer;
…
}
C) implements Player
{
…
}
D) {
Private ArrayList
…
}
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
78
The textbook recommends a five-part program development process consisting of the following activities:
I Use UML diagrams to record class relationships.
II Gather requirements.
III Implement the program.
IV Use CRC cards to identify classes.
V Use javadoc to document method behavior.
Which is the correct order in which these activities should be completed?
A) IV, II, I, III, V
B) IV, II, I, V, III
C) II, IV, I, III, V
D) II, IV, I, V, III
I Use UML diagrams to record class relationships.
II Gather requirements.
III Implement the program.
IV Use CRC cards to identify classes.
V Use javadoc to document method behavior.
Which is the correct order in which these activities should be completed?
A) IV, II, I, III, V
B) IV, II, I, V, III
C) II, IV, I, III, V
D) II, IV, I, V, III
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
79
You are designing a software solution for an automobile rental company. You have decided that the following nouns apply to the requirements: Auto, Customer, Address, Rental Contract, Mileage, Rental Date, Daily Rate, Total. Which of these should be represented as instance variables?
A) Mileage
B) Mileage, Daily Rate.
C) Mileage, Rental Date, Daily Rate.
D) Mileage, Rental Date, Daily Rate, Total.
A) Mileage
B) Mileage, Daily Rate.
C) Mileage, Rental Date, Daily Rate.
D) Mileage, Rental Date, Daily Rate, Total.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck
80
If you have parallel arrays or array lists of the same length which each store a part of what could be considered an object, ____.
A) You should rewrite the program to use a two-dimensional array.
B) You should rewrite the program to use a two-dimensional array list.
C) You should create a class to hold the related data in the ith slice of each array, and then create an arraylist of objects.
D) There are no alternatives to this type of program design.
A) You should rewrite the program to use a two-dimensional array.
B) You should rewrite the program to use a two-dimensional array list.
C) You should create a class to hold the related data in the ith slice of each array, and then create an arraylist of objects.
D) There are no alternatives to this type of program design.
Unlock Deck
Unlock for access to all 104 flashcards in this deck.
Unlock Deck
k this deck