The opening measures of Mozart's Sonata K. 283 in G major are an excellent example of how the tonic (I), subdominant (IV), and dominant (V) chords can be used. In the key of G major, G is the tonic, C is the subdominant, and D is the dominant.
In the first few measures, Mozart plays the chords as arpeggios, playing the notes consecutively. He also uses chord inversions. In an inverted chord, the lowest note is not the root. For example, in measure two, Mozart uses a D dominant seventh chord (D-F♯-A-C), but he uses A as the lowest note (see Inversions).
In the next image: