or is it possible only by (1) applying a magnetic field and (2) stroking the bar with a magnet?If possible, then how does electricity turn an iron bar into a permanent magnet?
Yes you can. All you need to do is wrap a coil of wire around it and pass a current through the wire. A magnetic field will be generated around the wire that will be concentrated along an axis that runs through the loops of the coil. The iron bar should then the slowly withdrawn from the coil. If it is soft iron, it won't stay magnetised for very long. For hard iron, the process will need to be repeated, maybe several times.
Iron is a soft magnetic material; which means that it can be turned into a magnet BUT will lose its magnetism once the action of magnetizing is interrupted. It does not matter what method is being usedapplying a magnetic field, stroking with another magnet or electromagnetism will all produce the effect temporarily. A current carrying conductor creates a circular magnetic field around it (even when no iron is present). The strength of the field depends on the current passing. If a coil of insulated copper wire is wound around a soft magnetic material, this will turn it into an electromagnet as each turn behaves like a small magnetic field. If you wanted a permanent magnet the iron would have to be replaced by certain types of steels.
Current has field around it this field can magnetize the iron 1) yes 2) not quite efficient