Why is sunlight spectrum continuous? My teacher explained today that unlike the spectrum obtained by analyzing the sunlight, the spectra of atoms are not continuous.
I have a question about this - the sunlight is emitted by the atoms of the elements composing the sun. So, spectrum obtained by sunlight is continuous despite its atomic spectra. In order for sunlight spectrum to be continuous and atomic spectra to be discontinuous, can we assume that sun consists of all those elements (sodium, helium, neon, mercury, etc) which emit the colors of frequency belonging to visible region?
 A: This is quite a natural confusion. You are correct, were the Solar spectrum purely due to the spectral output of the atoms composing it, we would not be able to get a continuous spectrum. However, the light emitted by the Sun is due to its temperature. All objects that are above $-273.15^{\circ}C$ (so, all objects) emit radiation at a continuous spectrum that relates to their temperature, we call the temperature dependent spectrum a "blackbody" spectrum. The Solar spectrum is practically a perfect fit for this relation for a blackbody temperature of about $5250^{\circ}C$. 
If your interested in a bit more information including how we are able to see a continuous spectrum, check out a previous post of mine here.
A: We have two type of atoms comprising most of the sun's structure: hydrogen and helium. And these have a noncontinuous spectrum.
But the sun has a continuous spectrum like a black body radiation because of free to bond or free to free radiation. There are three types of transition:


*

*bond to bond (which is discrete)

*free to bond (a free electron bond to an atom and radiate photons with continuous frequency)

*free to free (a free electron change its speed due to interaction with a potential and radiate photons with continuous frequency)
The last one also called Bremsstrahlung radiation.
So free electrons in the plasma medium in the sun's corona radiate Bremsstrahlung radiation due to statistical collisions and the output result is a continuous spectrum like back body radiation.
The tungsten in bulb light also behaves in this manner. Electrons from electrical current collide with heavy atoms and free-free transitions occurred (Bremsstrahlung radiation) and we have a continuous light due to this interaction.
This is also true for continuous radiation of hot objects and metals.
It is also important to note that Doppler broadening is not the answer because it has a very small bandwidth ($\ll1$ nm) for gas speed distribution.
A: The sun's spectrum is very complex, and indeed there are a lot of "lines"—both light and dark (emission and absorption)—amidst a sea of what looks to be continuous frequencies. 
Note that the atoms you study in a textbook are idealizations. In a hot object such as the sun, some photons come to us by way of atomic emissions, but the speeds of the atoms that emitted them are distributed continuously (something like the Maxwell–Boltzmann distribution), so there is a Doppler shift to each emitted photon. This "broadens" the spectral line, i.e., turns a discrete frequency into a continuum. This is called Doppler broadening or thermal broadening. However, this is not sufficient to produce a near-completely thermal black body spectrum (thanks to gigacyan for pointing out that this wasn't clear).
Other photons were emitted by nuclear processes and have been bouncing around inside the sun for many years (an astrophysicist could probably tell you how many), and each of these collisions has shifted its energy in a somewhat random fashion. Furthermore, this energy from fusion, along with gravitational effects, leaves most of the sun in the plasma state, where ions and electrons are separate from one another. Because this plasma is extremely hot, collisions and recombinations produce even more radiation which is the primary source of the light that reaches us. What we see is called the photosphere, which is the region of this plasma from which light can escape.
The overall effect is called thermalization, where the energy gets moved around in bits and pieces until everything is in thermal equilibrium. In the case of the sun it is only approximate, as different parts have different temperatures, so it is merely a tendency.
A: The continuous spectrum of the visible photosphere of the Sun is attributable to the radiative equilibrium of the $\mathrm{H}^{-}$ ion. This has been recognised for at least 80 years (Wildt 1939).
This ion forms by the attachment of a free electron (with a continuous spectrum of energies) to a hydrogen atom, emitting a continuous spectrum of photons in the process. The reverse process, photo-detachment, occurs at the same rate and is the principal source of continuum opacity in the solar photosphere.
Absorption and emission by H$^{-}$ ions demands that the temperature is low enough not to dissociate the extra electron ($<10^{4}$K), but high enough that there is a supply of free electrons donated by the ionisation of alkali metals ($>3000$K) such as sodium and potassium.
Superimposed on this continuum are dark, discrete absorption features caused by transitions within atomic species (mainly metals, but also hydrogen). These are dark because the photons at these frequencies arrive here from higher up in the atmosphere at cooler temperatures.
The original question asks only about "sunlight", and the H$^{-}$ opacity mechanism is only effective between about 3,000-10,000K. Stars with hotter or colder photospheres are dominated by different opacity and hence emission mechanisms.
In hotter stars the primary sources of continuous opacity at visible wavelengths, at temperatures exceeding 10,000K, are scattering by free electrons and the Paschen continuum arising from transitions between the $n=3$ state in hydrogen atoms and ionised hydrogen. There are also smaller contributions from free-free transitions of electrons in the electric fields of ions (bremsstrahlung).
There can of course be a cooler, overlying layer in hot stars where H$^{-}$ can form, but it has a lower density and a small optical depth (i.e. photons travel through it) and it therefore does not contribute significantly to the photospheric continuum.
In very cool photospheres, there are no free electrons and the atoms begin to form molecules, like carbon monoxide, water, molecular hydrogen, titanium oxide, vanadium oxide etc. There is actually very little true continuum absorption/emission in the visible part of the spectrum of these stars. Instead there is an overlapping mess of rotational and vibrational molecular transitions that form a pseudo-continuum when observed by instruments with finite spectral resolution. The dominant opacity in the visible spectrum at just below 3000K is due to TiO molecules.
At even lower temperatures (below 2500K, and approaching the substellar regime), absorption and emission by dust becomes important, although there is negligible flux at visible wavelengths.
A: Certain wavelengths of electromagnetic spectrum is emitted when the electrons in an atom to move from a higher level to a lower. The wavelength that is emitted depends upon the number of shells the electrons move down. When an electron/electrons move into certain number shells, white light is emitted i.e. when two hydrogen atoms fuse into an Helium atom, visible light is produced. As we know, visible light contains of all the wavelengths of colours from red to Blue. When a spectrometer is used, we are able to see a range of frequencies and therefore, calling it "Continuous Spectrum". 
However, spectrometer is used only to analyze the light that is visible to us. You can't analyze the frequency that aren't visible to us. As you said, sodium, neon and mercury do exist in sun but, they don't emit light that is visible to us. Since only we see white light, you just see that light split apart into a continuous range of colours
