Just out of curiosity, is this in any way related to the French "chapeau", either as a loan word or through a common linguistic root?
A hat is şapka in Turkish and is pronounced exactly the same as the Ukrainian counterpart.
Would cap be included in the general translation or is there another word to be used for it?
It all depends on particular type of cap/hat. Usually when we say шапка we mean something like knit cap. If a cap has a visor, it can be called картуз, кашкет and кепка. Swim cap is шапочка для плавання. If a hat has a brim it's usually called капелюх.
Shouldn't the translation be "This is my hat."? The app provides the translation "It is my hat."
A few people have already brough it up, but the issue is still there. шапка is a "cap", while the translation duo offers - a "hat" - would be капелюх - a very specific kind of headwear.
Now, you wouldn't translate "these are my shoes" to "these are my sandals", even though they both are kind of a footwear, and it's the same kind of mistake translating "this is my cap" to "this is my hat". It's just not equivalent.