Worrying about being able to solve math problems, or failing in a test preoccupies the working memory so much that, it leaves little of working memory less of it available to tackle the math problem...
Read this post on scienceandsamosa.com