Permanent magnets are made from materials such as iron, nickel, and cobalt. These materials are magnetized by aligning the magnetic domains within the material. This can be done by exposing the material to a strong magnetic field, or by heating and cooling it in a magnetic field.
Temporary magnets are made from materials such as soft iron. These materials are not able to retain their magnetic properties when they are not exposed to an external magnetic field. This is because the magnetic domains within the material are randomly aligned, and they do not align themselves with the external magnetic field.
So, to answer your question, a magnet can be switched on and off if it is a temporary magnet. This is because the magnetic domains within the material can be aligned with an external magnetic field, and they will remain aligned when the external magnetic field is removed. However, a permanent magnet cannot be switched off because the magnetic domains within the material are permanently aligned.