Should an embedded question be set in quotation marks?
There are direct questions, indirect questions, and embedded questions, and accepted practices vary between them.
Jim asked, “Should quotation marks be used?”
“Should quotation marks be used?” asked Jim.
Jim asked whether quotation marks should be used.
Jim’s question is, should question marks be used?
Note carefully the differing conventions of capitalization, quotation marks, and even question marks in all of those.
See also What is the correct punctuation for an indirect question?, Changing subject and verb positions in statements and questions, “I'm not sure what the right way is”, What kind of punctuation should I use to embed a question in another sentence?, and related questions linked to from those.