The way I think of these beginner harmonizing exercises is like Sudoku.
You have to try out chords and see what fits. Start with the G major chord and then add another chord. If you see consecutive 5ths or 8ths, remove it and and another one. If you cannot find one that fits, that means the previous chord might need changing.1
Now, something more you need to consider is that these beginner exercises don't always care for musicality. So, in the shown example you might need to harmonize every single note of the melody. In a normal song/composition this might not be the case, but this is a beginner exercise, so try to do that.
If you haven't seen passing notes on your book yet, don't use them. You might know what they are and how to use them but you've not been taught. So, refrain from using them, as well as the second inversion chords etc. Since you've only been taught about root position and first inversion chords, only use them.
1 How do you find which chord to use? First you start by finding the scale. It has a F#, so it has to be G major or E minor. Since the melody starts with G and ends with B, it's got to be G major.
Now, look at the notes. Each note points to one or two (or three) chords. Usually, these exercises start with the tonic chord, so the first one is G major.
The second note is B. The chords in the G major scale that contain B are: G, Bm, E. So you can pick one of those and see what fits! You can try to inverse one of them if you like.