An electron gun is a device that emits a focused stream of electrons. Its primary function is to generate a controlled beam of electrons, typically for various applications such as cathode ray tubes (CRTs) in old television sets and computer monitors, electron microscopes, and other vacuum tube-based devices. The electron gun consists of a cathode, which emits electrons when heated, and an anode, which accelerates and focuses the emitted electrons into a beam. The controlled movement and intensity of this electron beam allow for the creation of images on a screen or the illumination of specimens in electron microscopy.