CAIRO — Vexed by cheating on high-school exams, an age-old problem abetted by social networks and smartphones, the Algerian government reached this week for a drastic response: It turned off the internet.

Internet access has been shut down nationwide for at least an hour a day, beginning on Wednesday, at the times when students are taking the annual baccalaureate exams. In addition, “all smart devices that can access the internet” have been removed from the country’s over 2,000 examination centers, Algerian state news media said.

The digital blackout is intended to spare the country from a repeat of mass cheating scandals that have embarrassed it in recent years. In 2016, some high-school exam questions were posted on social media before or at the start of the tests, marring the results. The government’s failure to secure the exams was widely criticized and ridiculed, and it was forced to organize a new test for latecomers, who might have had illicit access to the questions.

Exasperated, Algerian education officials asked internet service providers to block social networking websites like Facebook during last year’s exams, but some of the questions still managed to find their way to other online platforms, reviving the uproar.