If a worshipper is asked an inquiry and responds using a Quranic verse with the intention of answering the speaker, what is the status of their prayer?

Invalidations of Prayer Part 2: Excessive Actions and Excretions