I recommend you to study International Phonetic Alphabet to discern the difference between g and h in Dutch. So Dutch h is not like our h in English. Think of saying hi but making the h harder, but don't hack it. Dutch g is a bit complicated. I place my tongue at my velar which is the spot before my uvula to pronounce the g. Note that you have to pronounce it harder otherwise it's gonna sound like a g in middageten. Dutch IPA for h is [ɦ], for g is [ɣ]. The g in middageten is [x]. I recommend looking at Wiktionary and Wikipedia for pronunciations. I don't trust the Dutch speakers Duolingo chose for this course due to pronunciation inconsistencies.
A cap would be called "een pet" in Dutch.
The English word "hat" is actually much broader than the Dutch "hoed"."Hoed" almost always implies a brim around the whole hat, like a fedora or top hat. With a partial brim (like a cap), it would be "een pet". With no brim (like a winter hat), "een muts".
There is the general hoofddeksel. Which means anything that goes on (covers) your head. So the otherwise uncategorisable nouns (that fall outside of the main groups of hoed, pet and muts) are still placed in a general categor.
A mitre (like a bishop /sinterklaas wears) for instance isn't a hat, muts or pet either. But it is still a hoofddeksel.
They both mean the same (the).
de is used with common gender nouns, while het is used with neuter gender rules.
Sadly, there are no rules we can follow to distinguish both kinds of nouns, so mostly you just have to learn them by heart.
You can find some guidelines here on Duolingo (check on the discussions section when logging in through the website, not the app) and the grammar tips and notes available at the beginning of the articles skill (also on the website, not the app). You can also check www.dutchgrammar.com