From your previous study of the relationship between scales and keys, you know that scales provide the notes upon which melodies are built. This means a melody in the key of C will mostly use natural notes; sharps and/or flats will be less common.
Similarly, a melody in the key of G will feature notes from the G major scale, which includes the F# note. However, instead of placing a sharp sign before every F note, an easier method is to place a sharp sign on the top line of the music staff (the F line). This sign is called the key signature, and it indicates that all written F notes are played as F#.
For the key of C, which contains all natural notes, the absence of any sharps or flats after the clef is the indication of its key signature.
The following scale study is in the key of G major and features F sharp notes (as indicated by the key signature). Notice that the F sharp is placed immediately after the clef, before the time signature, and that it must be written at the beginning of every staff.
Remember that all F notes are sharpened and be careful of your timing where the ties occur, particularly in bars 13 and 14.