Scottish Conservative MP Andrew Bowie said “plummeting teacher numbers and spiralling levels of school violence” had made it a difficult year for pupils.

He added: “This has created a challenging environment for pupils to get the grades they hoped for, which is why they deserve a huge amount of credit for achieving great results.

“However, it’s clear some pupils are still facing a postcode lottery when it comes to educational achievement.”

The Scottish Greens called for “high-stakes exams” to be replaced with continuous assessment.

Laura Moodie, the party’s education spokeswoman, said: “We need an education system that recognises achievement throughout the year, not just on exam day.”

Scottish Liberal Democrat education spokesperson Duncan Dunlop said: “The new education secretary needs to address the teacher job mismatch, make sure kids are learning skills that equip them for the future and finally deliver on efforts to tackle the poverty-related attainment gap.”