Later, you are talking to an acquaintance and you have to introduce them. This is the name part of the memory task, and it is about recall rather than recognition. Politeness demands that you say, "This is my friend X", and you have to fill in X with the correct name. A simple yes/no answer will not work here.
In other words, faces are given to us – they are there when we look at the person we are thinking about – and all we have to do is know whether we have seen them before or not. Names, on the other hand, are hidden in memory and we have to retrieve them, which is a far harder psychological task. But once you realise that recalling names is just intrinsically harder than recognising faces, you need not be too hard on yourself for forgetting your neighbours’ or co-workers’ names anymore. Instead, you could try some fundamental psychology tricks to help you remember them.
Experiments on memory have shown that simply trying hard to remember things doesn't really help. Of far more use is to repeat the thing you're trying to remember, and to form associations with it. So if you want to remember names, you need to use them frequently when you first meet a person. You might have noticed people doing this with you. You say "Hello, I'm Ravi", and they say "Hello Ravi, what do you do in life?" or something similar, immediately practising using the person’s name.
If there is someone whose name you really need to remember, you should make an image in your mind that connects their name with something you have found out about them, ideally combining both in a striking or absurd image. So, for example, if you meet a Jennifer, and you find out that she is from Alaska, you could imagine her standing in the centre of a snowy town (Alaska is cold, right?) and wearing a fur coat (for JenniFUR). Just spending a few seconds building a mental image around the name will create hooks of memory, which will let you recall the name next time you meet her. Practise this method and you need never be embarrassed at another party.