onsemi interview question

Explain what a voltage regulator does. What are the differences between a PMOS and NMOS?