I know that the next sentence is correct:
What are you going to use it for?
But I was wondering if the following one would be correct as well:
For what are you going to use it?
I had a conversation with my friend where he had noticed my wrong use of the second sentence. Was his remark right?