In a hat x Under a hat: Qual utilizar

I took a test last week and I didn't know how to answer that:
Someone is in a hat or under a hat?
I just chose under , is that right?
MENSAGEM PATROCINADA Você sabe como está o seu nível de inglês? Teste agora GRÁTIS em apenas alguns minutos.

Clique aqui para iniciar o Teste Online!
Por favor, nos dê mais contexto
Avatar do usuário Redseahorse 10490 1 13 208
No, that´s wrong.

IN A HAT suits better. Weird sentence, anyhow. I'd say ' SOMEONE IS WEARING A HAT '
Avatar do usuário PPAULO 45495 6 35 805
With the description of clothes and some kinds of acessories somebody is using/is wearing, it´s acceptable the form "in":

Men in suits posed by house with pretty woman in dress.

Little boy in hat looking at camera.

Cat in spetacle tote. (bolsa de compras de loja com figura de gato usando óculos.

Men in Black (homens de preto) meaning - men in black outfits.

It´s also acceptable to stablish which predominant color is the clothes:
Lady in red. (a dama de vermelho...)

As you see, it´s equivalent to a shortening of the statement, it leaves it pretty economical with words.
Avatar do usuário PPAULO 45495 6 35 805
Someone is in a hat or under a hat?

I can see your puzzled expression, even if I wasn´t there...It´s because "under" also means some object "covered" by other.
https://www.espressoenglish.net/prepositions-of-place-in-english/

But then, if it´s too easy then there might be some kind of "catch", and it was the case.
Because there are day-to-day expressions in English which they put the learn to test, so "in hat/in red/in spetacles" may convey that sense I have dealt with.
One thing is certain, this one you will never unlearn! I had a teacher that said that the mistakes are the mother of all learning! ;-)
Be welcome to the world of catches in tests and exams, smell the coffee! ;-)