As a native English speaker, cap has a brim. A cap is a type of hat. Hat is the larger group or general reference. I would never wear a 'cap' in the winter. I would say baseball cap and it would be a summer hat with a brim only over the eyes. Hat is something worn over the head in all seasons because its general, so not specifically with or without a brim.
Shape is important is Russian, too. I tend to think generally that a шляпа has a brim (fedora, sombero, trilby, cowboy hat) while a шапка does not (stocking caps, those fur hats with ear flaps, Santa's hat) and a baseball hat or newsboy or flatcap would be a кепка.
A native could probably explain any subtleties to this.
Yes, I'd agree with that, for the most part. But there are some instances and places (probably regional, poetic, esoteric or archaic) where a knit шапка might be called a "cap". The "cap" in "'Twas the night before Christmas" (http://www.poetryfoundation.org/poem/171924) is almost certain a шапка.
This is a beanie; http://thumbs1.ebaystatic.com/d/l225/m/mmhPeTGpU8QJYhUpLvGrjng.jpg The knit version with a pom-pom is,in Canada, a toque.
The sentence is general in nature, and with such general statements, you use the indefinite article "a". It would take a more precise or specific context to make "the" applicable.
Some sentences have a self-contained context which makes use of "the" permissible. This sentence doesn't.
I believe in this context in Russian it would still be an adverb, but in English you'd use the adjective "right" or "correct". Regardless, to answer your second question, it would all be based on context. For instance, <Он все правильно сделал> (he did everything right), it would be the adverb - it clarifies how (как) something was done. I can't honestly think of a case where the short-form adjective of правильный would be applied, either...
Правильно functions either as an adverb or a predicate adjective.
If it's an adverb, what verb is it modifying? The only verb in the sentence is "is", and saying "This is correctly a hat" is awkward, unnatural, and doesn't make much sense.
As a predicate adjective, the sentence makes a lot more sense: "[This is] correct, it is a hat." (Except it really should be "cap" rather than "hat".)
Same in Hungarian, sapka means hat! Crazy how many words are exactly the same in those two languages.
In both the English and the Russian, "it is/это" are omitted. There's also no way of knowing what "it" refers to. Also, most of the time in English, the phrasing would be "You are correct, this is a hat". That introduces ambiguity into the possible translations of Правильно: does it mean "it" (perhaps a statement about the hat) or "I/you/he/she/they" - the person making the statement about the hat.