Pergunta de entrevista da empresa EXFO

how singleton and factory design patterns work?