A device which converts chemical energy into electrical energy is called ?

A. motor
B. generator
C. moving-coil meter
D. battery