According to grammarly.com, a question mark needs to be within the quotation marks, if it is only relevant to the quote itself, but it has to be outside the quotation marks, if it relates to the whole sentence. Grammarly provide the following examples:
- Sandy asked them, “Why do you guys always fight?”
- Did the dog bark every time he heard Sandy say “I’m bringing dinner”?
Consequently, answer A is correct, because the question mark applies to the whole sentence, and therefore it must be placed outside the quotation marks.