87.5% of those who passed the first test also passed the second test.
Lets assume, the total number of students in the class = X
As 80% of the class passed the first test, so the number of students passed the first test = 80% of X

and the number of students passed both tests
= 70% of X

It means, this 0.7X of those who passed the first test also passed the second test.
So, the percentage of 0.7X in respect of 0.8X is :

Thus, 87.5% of those who passed the first test also passed the second test.