onsemi interview question

Explain how bjt and mosfet transistors function.