How should the sentence below be rewritten to avoid incorrect punctuation?

"What is the name of your dog"? my friend asked.

Respuesta :

"What is the name of your dog?" my friend asked.
It should be written
"What is the name of your dog?" my friend asked.