Question: when x rays are produced?
Answer: X-rays are produced when the electrons are suddenly decelerated upon collision with the metal target; these x-rays are commonly called brehmsstrahlung or "braking radiation". If the bombarding electrons have sufficient energy, they can knock an electron out of an inner shell of the target metal atoms.