Assume that there are 100 students in the class.
(Working with numbers is easier than working with percentages).
There are 27 students who passed both tests, and 51 who passed only the first test.
The 27 students who passed both tests are included in the 51 who passed the first test.
We are asked "What percent of those who passed the first test also passed the second test?"
so we are asked "what percent of 51 is 27?"
let 51 be 100%
then 27 is

%=52.941%
Answer: 52.941%