Carpmaels & Ransford interview question

How does an electrical generator work?