The misplaced modifier is "wearing a bandanna." This sentence suggests that the building is wearing a bandanna, however the actual word it is trying to modify is the man.
<em />I am doing the exact same thing. I don't know what I'm doing!!!<em />
Answer: B is the correct answer for a direct object because that's what the sentence mainly about ( Which you already did it)
The next one is B again because she wanted pizza which is for direct object
I might get it wrong but these are my guesses