A growing number of high school students are abandoning science and mathematics in their final year.