A transistor is a miniature semiconductor that regulates or controls current or voltage flow in addition to amplifying and generating these electrical signals and acting as a switch/gate for them.
Typically, transistors consist of three layers, or terminals, of semiconductor material, each of which can carry a current.
The word transistor is a combination of transfer and resistance.
This is because it transfers the resistance from one end of the device to the other end or we can say, transfer of resistance.
Transistor has a very high input and very low output resistance.
Diode:
A semiconductor device in which current flows only in one direction.
The diode is used for converting AC to DC or for rectifications whereas the transistor is mainly used for amplification and as a regulator.
The diode has two terminals namely an anode and cathode.
The anode is the positive terminal.
The cathode is the negative terminal of the diode.
The conduction occurs in the circuit when the diode is forward-biased.
The forward bias means the P-type material is connected to the positive terminal of the battery and the N-type material is connected to the negative terminal of the battery.