All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
Students gossiping and playing with their mobile phones indicate that their heart is not present with their teacher and that they are not attentive to the lesson. This is a kind of betrayal to the teacher as he exhausts himself in teaching and explaining the lesson to the students while they do not listen or pay attention to him or care about his lesson. However, this is not cheating with the known meaning of getting information in exams in an unlawful way.
Allah knows best.