Question 1 - how it is a sample
As the statement, "A sample must be random and represent the entire population." is true.
In the given case, the opinions of the student's of one class is not the opinions of the students of other classes. Also the students are not chosen randomly. So, how can it be a sample?
You are aboslutely right about your defition of sample.
In order to obtain a representative sample, you would typically want to ensure that your sample is selected randomly from the entire population of interest, or you would use specific sampling techniques to ensure that it accurately reflects the diversity and characteristics of the population.
However, If you only consider the opinions of one class of students and they were randomly selected, you cannot make generalizations about the opinions of all students across different classes or the entire population.
This is an assumption that is part of the analysis.
The 365 Team