If u set a multimeter to the resistance measurement setting, there is a voltage available on the terminals, oppsoite in polarity to the terminals. Clip the terminals to the emitter and collector in any way. Now when u earth the base by a metal object say a forcep or a screwdriver or by ur hand, the resitance between the emitter and collector terminals will drop significantly if the terminals are applying voltage to the emitter and collector in the proper sense i.e. for the npn transistor emitter is connected to negative i.e. the red terminal and collector to the positive or the black terminal. The reverse is the case for pnp transistor. If the terminals are not connected like this the resistance drop will be almost insignificant.
It works for many transistors.