Inversion in questions
In an affirmative sentence, the verb goes after the subject. However, the auxiliary verb can go before the subject of a clause in several different structures. This is called inversion. Inversion is quite common in questions.
He goes to work every day. (Affirmative)
Does he go to work every day? (Question)
They live in Bangkok. (Affirmative)
Do they live in Bangkok? (Question)
She is working at the moment. (Affirmative)
Is she working at the moment? (Question)
John and Mary have arrived. (Affirmative)
Have John and Mary arrived? (Question)
Note that in questions only the first auxiliary verb goes before the subject. The remaining part of the verb goes after the subject.
Have they been invited? (NOT Have been they invited?) (NOT Have been invited they?)
In Wh-questions the auxiliary verb goes after the question word.
Where are you going? (NOT Are where you going?) (NOT Where you are going?)
Note that spoken questions do not always have this word order.
You’re coming with us? (Spoken question)
Are you coming with us? (Written question)
As you can see a spoken question has the same word order as an affirmative sentence, but it is said with a rising intonation.
We do not use inversion in indirect questions.
I wonder what she is going to do. (NOT I wonder what is she going to do.)
I asked what time the show was starting. (NOT I asked what time was the show starting.) (NOT I asked what time was starting the show.)