Many melodies use notes from outside the scale, particularly in styles such as Rock, Funk, Blues and Jazz. These "outside notes" are called accidentals. An accidental is a temporary alteration to a note or notes from a particular key.
Therefore, if you have a piece of music in the key of C which contains notes which are not in the C major scale, you can relate these notes to the C chromatic scale.
On the recording, this melody is played by a guitar. Sing along with it until you can match the pitches and then sing it from memory without the recording. Singing melodies containing accidentals takes a bit of practice, But it is a great way to improve your sense of pitch.
The next two examples are the same melody transposed to the keys of F and G. Once again, you should transpose this melody to all the other keys in the key cycle. It is worth learning to sing the chromatic scale starting on any note of the key cycle. Once you can do this, it will be easier to learn more complex melodies in any key and also easier to transpose any melodies from one key to another to suit your voice.
Here is another melody in the key of C. Analyze its degrees and then transpose it to all twelve keys.