The anode and cathode nomenclature for a device depends upon the device type and
the mode in which it operates.
Generally speaking, the elctrode at which current goes out of the device is termed as
cathode and the electrode where current enters is the anode.
In a p-n junction, the current goes in the device at the positive terminal and comes out
at negative terminal in forward operation. Hence, anode is the positive terminal
and athode is termed as the negative terminal. You should remember these terminologies
according to the device and the mode of operation. If mode of operation changes, the
nomenclature also changes. One rule that at cathode current goes out can always
help to identify anode and cathode.