Yes, and it's good for H2 Chem students to broadly understand the concept behind the different colours (though it's unlikely for Cambridge to specifically ask on this, as it's not specifically required by the H2 Chem syllabus).
The origin of flame colours
If you excite an atom or an ion by very strong heating, electrons can be promoted from their normal unexcited state into higher orbitals. As they fall back down to lower levels (either in one go or in several steps), energy is released as light.
Each of these jumps involves a specific amount of energy being released as light energy, and each corresponds to a particular wavelength (or frequency).
As a result of all these jumps, a spectrum of lines will be produced, some of which will be in the visible part of the spectrum. The colour you see will be a combination of all these individual colours.
In the case of sodium ions (or many other metal ions), the jumps often involve very high energies and these result in lines in the UV part of the spectrum which your eyes can't see. The jumps that you can see in flame tests often come from electrons falling from a higher to a lower level in the metal atoms.
So if, for example, you put sodium chloride, which contains sodium ions, into a flame, where do the atoms come from? In the hot flame, some of the sodium ions regain their electrons to form neutral sodium atoms again.
A sodium atom in an unexcited state has the structure 1s22s22p63s1, but within the flame there will be all sorts of excited states of the electrons.
Sodium's familiar bright orange-yellow flame colour results from promoted electrons falling back from the 3p1 level to their normal 3s1 level.
The exact sizes of the possible jumps in energy terms vary from one metal to another. That means that each different metal will have a different pattern of spectral lines, and so a different flame colour.
Also see :