Kaffe, when used in a sense of "cup of coffee" can also have utrum gender (en kopp kaffe = en kaffe). In that case "Pojken dricker den" would be correct, I believe.
I am having a difficult time discriminating between den and dem. In fact it almost seems that I am always hearing the opposite (den when it's dem and dem when it's den). What am I missing? Here I was congratulating myself on my improvement in my listening skill and then went back to this very early exercise and feel like I am back to square one. Is there any help.
The best advice is probably to skip the consonant if it's giving you trouble, since dem is actually pronounced with an o sound: dom.
In this case, Swedish den and dom sound quite close to English "den" and "dom", so I'd suggest using them as rough equivalents.