Carpmaels & Ransford interview question

Explain how an electric generator works.