Pregunta de entrevista de Texas Instruments

How does a transistor work as a switch?