IMHO the real problem here since a long time is that exams have been demonstrated to be flawed. You can pass an exam and have no idea on the subject. The whole system is flawed, we need a new education system.
The goal is to test whether someone has learned something. The most obvious way is to ask them a series of questions to confirm that they have learned it.
There are some other obvious alternatives, like having them do a project that would require having the knowledge you wanted them to learn, but those methods don't scale and are just as, if not more, vulnerable to cheating (it is common in Indian universities to hire someone to do your capstone project for you).