Singleton Pattern - Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.
 
1. The general purpose of the Singleton pattern is to:
Please select the best answer.
  A. Ensure that no more than one instance of a class exists.
  B. Ensure that only one instance of a class exists at the same time.
  C. Separate objects in a single class from objects in another class.
  D. Control creation of objects in a single class or another class.
  The correct answer is A. The Singleton pattern ensures that no more than one instance of the class exists ever.
It does not allow one instance of the Singleton to be destroyed and then another one created. In general, a Singleton has nothing to do with separating objects in different classes. A Singleton does control creation of objects, but not in a single or another class.

2. The participants in a design pattern are:
Please select the best answer.
  A. The methods used in the pattern
  B. The other patterns that participate with the pattern
  C. The classes and objects used in the pattern
  D. The fields used in the pattern
  The correct answer is C.
A class pattern has mostly class participants. An object pattern has mostly object participants. However, many patterns have both. Fields and methods only enter into patterns as parts of the classes and objects they belong to.

3. The consequences of a design pattern are:
Please select the best answer.
  A. The pitfalls of using the particular pattern
  B. The results of choosing a pattern
  C. The time a program using the pattern takes to run
  D. The time it takes to design a program using the pattern
  The correct answer is B. Although the English word consequences has a somewhat negative connotation, in the context of design patterns it includes all major results choosing or using a pattern, both positive and negative. Of course for good patterns that fit the problem they're being used to solve, the positive consequences should outweigh the negative ones.

4. Which of the following is specifically in the realm of applicability of the Singleton?
Please select the best answer.
  A. The class has only a single member method.
  B. The class has only a single field.
  C. The class should have exactly one instance.
  D. The class cannot be subclassed.
  The correct answer is C.
Although many of the examples in this module used classes with only a single static field, in more specific cases the class can have many different static and instance fields and methods and still be a Singleton. The single in Singleton refers to the number of instances of the class, not the number of fields or methods in the class. D is incorrect because Singleton classes can be subclassed.