Pergunta de entrevista da empresa Texas Instruments

How does a transistor work as a switch?