Once the question of an exam has been formulated, the usefulness of the problem is already been completely destroyed, because formulating the problem that matters is the most important part of things. And any problem with an answer, is useless to put effort into: give answers.
Furthermore, preventing people from searching for answers while answering an exam, AKA preventing "cheating", also makes absolutely no sense. In the real world, we want people to find answers as quickly as possible! We should be teaching people how to "cheat"! What we should teach them instead is what a fucking license is, and what you have to do to comply with it.
And if you must absolutely have exams, they must be open to anyone who wants to applies. Then people have to pay to take the exam, with subsidies for "official course takers", who are spending 100x more anyways due to not living with their parents.
And if you pass the exam, you pass the course, without any further time requirements.
And those exams must be applied by professional test application companies to ensure no cheating and to factor out the anti-cheat work, while still making the tests available to people anywhere.
A quote from Richard Feynman present in the book Surely You're Joking, Mr. Feynman chapter O Americano, Outra Vez!:
You cannot get educated by this self-propagating system in which people study to pass exams, and teach others to pass exams, but nobody knows anything.You learn something by doing it yourself, by asking questions, by thinking, and by experimenting.