What is the impact of performance during cognitive tests on the widely studied gender gaps in test scores? This paper uses PISA data and exogenous variation in question order to investigate the dynamics of gender gaps during the test. It shows that the relative performance of girls improves as the test proceeds and that this result is robust to the topic being considered. In math and science, boys perform better at the beginning of the test, but girls reduce or reverse the gender gap in math and science as the test goes on. In reading, girls do better early on, and increase their advantage as the test proceeds. Measures of noncognitive skills, like locus of control and conscientiousness, do not explain the gender difference. To further investigate potential determinants we use the most recent computer based PISA wave, which gives detailed information on effort during the test and restricts navigation across questions. Results are similar for the computer based test, which implies that our finding is not driven by test taking strategies. Using data on time spent and number of actions per question, we find that the dynamics of these proxies for effort do not show strong differences between the sexes. This suggests that girls’ ability to translate inputs into a correct answer declines at a slower rate as the test proceeds. Overall, our results suggest that longer tests decrease the gender gap in math and science. We present supplementary across test evidence that this is indeed the case.