Design Patterns

Last Updated :
Discuss
Comments

Question 1

Which of the following is a creational design pattern?

  • A

    Observer

  • B

    Strategy

  • C

    Singleton

  • D

    Command

Question 2

 What does the Factory Method Pattern do?

  • A

     Shares data between classes

  • B

    Notifies observers

  • C

    Creates objects without specifying the exact class

  • D

    Destroys objects safely

Question 3

Which pattern provides a global point of access to a class instance?

  • A

    Factory

  • B

    Singleton

  • C

    Adapter

  • D

    Bridge

Question 4

The observer Pattern defines which type of relationship?

  • A

    One-to-many

  • B

    Many-to-one

  • C

    one-to-one

  • D

    Many-to-Many

Question 5

How does Singleton prevent multiple instances of a class?

  • A

    By using a public constructor

  • B

    By using private destructor

  • C

    By making constructor private and using a static method to access instance

  • D

    By using multiple constructors

There are 5 questions to complete.

Take a part in the ongoing discussion