Multiple choice technology architecture

What is a Singleton Pattern

  1. The pattern that creates many instances of a single class in one shot

  2. This pattern is to have only a single constructor to a class

  3. Provides a class of which there can be no more than an instance, and provides a single global point of access to that instance

  4. Creates and maintains a pool of objects, using which a single object can used and returned to the pool

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Singleton pattern ensures a class has only one instance and provides a global access point to it. This is useful for shared resources like database connections or logging services. Option A incorrectly describes creating many instances, which contradicts Singleton's purpose. Option B is insufficient because a single constructor alone doesn't prevent multiple instances. Option D describes the Object Pool pattern, which manages reusable objects.