Для преобразования косвенной речи в прямую речь, нужно переформулировать вопросы так, чтобы они звучали как непосредственные вопросы. Вот ответы на ваши примеры:
She asked me what I was doing there.
Прямой вопрос: "What are you doing here?"They asked me when I had arrived.
Прямой вопрос: "When did you arrive?"The teacher asked him if he knew what the answer was.
Прямой вопрос: "Do you know what the answer is?"He wanted to know if she had ever written a poem.
Прямой вопрос: "Have you ever written a poem?"I asked him what he would do with the money.
Прямой вопрос: "What will you do with the money?"I asked him how many pages the book had.
Прямой вопрос: "How many pages does the book have?"I asked her if that bag was hers.
Прямой вопрос: "Is that bag yours?"
Если у вас есть еще вопросы или нужно больше примеров, не стесняйтесь спрашивать!