The correct response is: when there is a chemical reaction between metals and nonmetals.
This type of reaction typically involves the transfer of electrons, which can result in the generation of electrical energy, such as in batteries and galvanic cells.