Capgemini Engineering interview question

Explain Singleton and Factory pattern