@tanguatlay,
They could both be correct. The first phrase is used in a quote:
Here I am answering the question, "when did he take off his shoes?"
The second phrase is used in reference to a question:
Here I am answering the question of when he took off his shoes.