Caption: A compact disc acts as diffraction grating because of the small pits on one side arranged in spiral (see Wikipedia: Diffraction grating: Examples).
This behavior is just a side effect of the compact disc function, and has NO function other than to make them look pretty incidentally.
Here dispersion is caused by reflection of many finely spaced pits arranged in a spiral (which break a wavefront impinging on them) that leads to diffraction of the reflected beams: the diffraction is big because the groove spacing are comparable to the wavelength of visible light.
Intentional diffraction gratings are widely used in spectroscopy which we discuss below in subsection How Does a Diffraction Grating Work?.
By the by, nowadays the compact disc is a retro technology (Wikipedia: Compact disc: Current_status).
Answer 2 is right.