The verb, subject, and object keep their roles. The question marker changes the purpose of the sentence.
Statement: كَتَبَ الطَّالِبُ الدَّرْسَ
The student wrote the lesson.
Question: هَلْ كَتَبَ الطَّالِبُ الدَّرْسَ؟
Did the student write the lesson?