In my mind, a stranger is a person with whom one has no previous acquaintance, and a foreigner is someone from a different country.
I notice, however, that at dictionary.com there are definitions which give overlapping meanings, especially to foreigner.
I think the exercise you quote is open to interpretation. One could, for example, say,
I'm English. I come from Brighton. In Paris I am a stranger. I assume they are looking for foreigner as the best choice, since the speaker is from a foreign country. However, the speaker could wish to say that in Paris s/he knows no one and is, therefore, a stranger.
I'm from Brighton. In Manchester, in the north of England, I am a
One assumes they are looking for stranger here, but according to several sources cited in Dictionary.com, foreigner would work, since it is defined as someone from outside one's own community.
I hope this is useful,
Student or Learner