Step 1: Find what the job needs:
To purify water, a radiation must destroy germs but should still be easy and safe to produce in a small lamp.
It must be an electromagnetic wave, so it should be able to pass through air and water and be absorbed by microbes.
Step 2: Remove the wrong options:
Ultrasonic waves are mechanical sound waves. They need a medium and are not part of the EM spectrum, so (D) is out.
Infrared waves mainly carry heat. They warm water but do not kill germs in a useful way, so (C) is out.
X-rays are very penetrating and hard to produce safely, so they are not used in home water filters. This rules out (A).
Step 3: Pick the remaining one:
Ultraviolet light has a wavelength shorter than visible light and photon energy of several eV.
This energy is enough to break bonds in the DNA of bacteria and viruses, so the germs cannot multiply.
UV water purifiers apply this idea. So the answer is Ultraviolet rays.
Final Answer:
Ultraviolet rays are used to purify water, which is option (B).
\[ \boxed{\text{Ultraviolet rays}} \]