Just more info. You have to write ぼうし but it's often pronounced ぼおし. It's confusing for learners. I'll give you another example. がっこう(school). it's pronounced がっこお。Boy's name、たろうis pronounced like たろお。
これは 誰の(だれの)帽子(ぼうし)ですかis correct. it's not かばん(bag). Sayaka's answer is right. And you cay say, このぼうしは、だれの(だれのもの)ですか too.