User Defined Types  «Prev  Next»

Class and Object Composition - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 
1. Consider a Check object and its associated Date object and Money object.
The object is named phoneBill. 
Check number 1023 is for &#3623.12. 
The check was written on July 7, 1998. 
The check was made payable to Bell Atlantic. 
The memo line contains
"June phone bill, 212-555-8767-R123." 
Which of the following is a correct object diagram for this object?
Please select the best answer.
  A. First Diagram
  B. second Diagram
  C. Third Diagram
  D. Fourth Diagram

2. Which of the following verbs best indicates a composition relationship between two classes?
Please select the best answer.
  A. Needs, as in " a fee calculation needs the interest rate"
  B. Is, as in " a car is a vehicle"
  C. Has, as in " a car has a transmission"
  D. Describes, as in " a priority describes a request"

3. The Money class is likely to be used as an attribute of the Check, Deposit, and CheckingAccount classes. Based on this decision, which one of the following statements is most true?
Please select the best answer.
  A. The same developer who works on the Money class must work on the Check, Deposit, and CheckingAccount classes.
  B. If the rules for Money change, Check, Deposit, and CheckingAccount must also be changed.
  C. The rules for Money need be written only once and can be used throughout the program.
  D. The system will be more vulnerable to bugs because the rules for Money are in only one class.

Correct answers:

Your Score: 0