The correct answer is A. To latch onto and let go of objects.
Being able to turn an electromagnet on and off allows it to pick up objects when energized (turned on) and release them when deactivated (turned off). While the other options can be benefits in certain contexts, they don't directly address the primary useful function of an electromagnet.