The present research investigates gender gaps in the results of secondary school exit exams (Matura) in mathematics in Poland in 2015. The analysis shows that, in the basic level exam, males are highly overrepresented at the upper end of the score distribution. The same pattern did not exist in the extended-level Matura. Two explanations are offered here. The differences are driven by gender self-selection in high school programs. Students who decide on maths-related tracks have more maths lessons than other students. Secondly, a student who takes the extended Matura also has to take the basic Matura exam. As a result, the population of students taking the basic Matura is highly differentiated in terms of maths competence and motivation. Additionally, the analysis of differential item functioning (DIF) shows that only a few items were flagged as having DIF.