EXFO Interview Question

how singleton and factory design patterns work?