AS LONG as there have been exams, students have found ways to cheat. Today the correct answers are just a few taps away on a smartphone. So countries have come up with new ways to stop the funny business. Some use metal detectors, surveillance cameras, mobile-phone jammers and even drones. Others have taken a more drastic step.

Cheating in high-school leaving exams got so bad in Mauritania and Algeria that this year the authorities turned off the internet for the entire country. Algeria did so for at least an hour during tests (which last about a week); Mauritania cut access from morning until evening on exam days. Other countries, such as Iraq, Uzbekistan and Ethiopia, have for years been shutting down the internet during exam time.

In each country students are under enormous pressure to do well in the tests, which often determine whether they can continue their education at a good university. A splendid grade may mean a scholarship abroad. But high marks are rare. In Algeria only around half of students passed the exams in recent years. In Mauritania the rate is much lower.

Teachers try to help—in their own way. For a fee some will provide answers on WhatsApp, a messaging service, says Sidi, a recent high-school graduate in Nouakchott, the capital of Mauritania. After Algeria’s tests were posted early on Facebook in 2016 the government blocked it during exam periods. Dishonest boys have a harder time than girls, who often aren’t checked and sometimes hide earphones under their veils.

Turning off the internet is expensive. Darrell West of the Brookings Institution, a think-tank, estimates that in 2015-16 internet shutdowns ordered by governments—whether to stop cheating or stifle dissent—cost countries at least $2.4bn. For that kind of money, countries could even improve their schools.