OO Concepts   «Prev  Next»

Object Characteristics - Quiz

Each question is worth one point. Select the best answer for each question.
 
1. In an earlier lesson, you learned that StatementPrinter is not a good name for a class. Which of the suggestions below would be better?
Please select the best answer.
  A. A general Printer class that prints passbooks, statements, and a variety of other reports
  B. A Statement class with a responsibility to print itself
  C. A CheckingAccount class with a responsibility to print a statement each month
  D. A global function that will print a statement for any CheckingAccount object

2. Which one of these characteristics defines a problem that can be best addressed with a structured programming approach?
Please select the best answer.
  A. The problem involves a simulation of a process.
  B. The problem involves user-interface-intensive operations.
  C. The problem involves events that do not occur at precisely defined points.
  D. The problem involves a well-defined flow of control.

3. If you are working with a system that already has a Date class, which of the following statements best illustrates encapsulation for that class?
Please select the best answer.
  A. You can change only the whole date, and not just one part of it at a time.
  B. You do not know what the internal variables are, but you know what a Date class can do.
  C. You know the internal variables and you know they will not be changed in the future.
  D. You can view the source of the Date class to decide if you should reuse it.

4. Still thinking about a Date class someone else has written, which of these statements best illustrates encapsulation?
Please select the best answer.
  A. When you reuse the Date class, it is encapsulated into your program.
  B. The developer who uses the Date class will implement whatever date rules (days per month, leap years, etc.) are appropriate for the system.
  C. Because all the variables about a date are encapsulated into one object, the program will execute more quickly.
  D. All the rules about dates (days per month, leap years, etc.) are encapsulated in the Date class.
Correct answers:

Your Score: 0