If you have a sentence like this: I stepped on a brick.
Then you can form a question about the object on which you stepped two ways:
- "What did you step on"?
- "On what did you step"?
The second one is used rarely and sounds very formal. As a general rule, if a sentence contains a preposition, and we ask a question about the object after the preposition, the question will have the form "What ... <preposition>?"
Other sentences that end with prepositions:
This is a pleasant city to live in.
This is what I was worried about.