The first is to make cards with the fret number on one side, and the notes of that fret on each string on the other side... then learn a fret at a time. After a few days of repetition you'll have them all.
The second is to learn all the notes on the 5th (A) & 6th (E) strings, and then use the octaves to find the notes on the other strings. 2 strings higher and 2 frets higher, it's the same note but an octave up... remember you need to compensate for the tuning of the G string though, so you'd go up 3 frets.
EG:
12th fret of the high E string = E
9th fret of the G string = E
7th fret of the A string = E
or
12th fret of the B string = B
9th fret of the D string = B
7th fret of the low E string = B
You probably only need to learn 50% - learn the whole notes, and the sharps/flats fall into place anyway... My only other advice is that if this is for a test, probably only a very small number of the marks are given for this knowledge, so you may be better using your time elsewhere - play percentages.
Good Luck.... :)
**EDIT**
Forgot about the fretboard warrior game - download here - some of the guys I've taught found it useful...
Check out my music, video, lessons & backing tracks here![br]https://www.renhimself.com