Using Trends in International Mathematics and Science Study (TIMSS) data for Egypt in 2007, this paper examines the determinants and gender inequality of educational attainment (test scores in Mathematics and Science). The complicated structure of the data is carefully addressed during all stages of the analysis by employing plausible values and jackknife standard error technique to accommodate the measurement error of the dependant variable and the clustering of students in classes and schools. A detailed analysis of Egyptian students' achievements reveals differential effects of school types, notably being single or mixed sex and Arabic or language schools. Single-sex schools tend to have higher attainment than mixed schools, especially for girls, and single-sex language schools have higher test scores than Arabic single sex schools. The better performance of language schools is related to the socio-economic characteristics of enrolled students.