How can you work out the number of sharps in a key?

The correct answer is "Go up the scale 5 notes at a time, and add the raised leading tone"

working