An exams scandal has cost the job of a top official as the government moves to ensure students' marks are not affected by the mix-up.