There are 24 students in the class. Take 2/3 of this to get (2/3)*24 = 16
A more detailed step by step would be
(2/3)*24 = (2/3)*(24/1) = (2*24)/(3*1) = 48/3 = 16
The result 16 is smaller than the original number 24. This is expected because 2/3 is smaller than 1. The key thing here is that the result 16 is a whole number.
You can think of 2/3 as the approximate percentage 66.7%, so you're applying roughly 66.7% to the entire class to get 16 people who like hip hop.
It appears you're thinking in reverse when you went from 24 to 36, because 2/3 of 36 is 24, but not the other way around. Keep in mind there are 24 students total in the class, and we can't go higher than this. We can't say there are 36 people who like hip hop.
So to answer the question, yes it is possible Gertrude's survey is correct because 2/3 of 24 is a whole number.