Before the last math test of the semester was handed out, the teacher said to Pisti, who stood between a 4 and a 5: "16 of you completed the test. I gave half grades. The range of the grades is 2, the mode is 4.5, and the median is 4. Among all the possible scenarios, the group achieved the lowest average. If you can tell me whether you could have gotten a 5 on the test based on this information, I will give you the grade at the end of the semester." What did Pisti answer, if she got the 5?
I. solution. Since the mode of the grades is 4.5, 4.5 must be an element of the range of the grades. Thus, the problem can be divided into two cases: the grades range from 3 to 5, or from 2.5 to 4.5. Since 16 students took the exam, the median will be the arithmetic mean of the two middle grades when the grades are arranged in ascending order, so the problem can be further divided into two cases: the two middle grades are 4, or one is 3.5 and the other is 4.5. Thus, the problem can be divided into four cases in total.

Since the mode is 4.5, in each case it must appear at least four times, otherwise at most $5 \cdot 3=15$ students could have taken the exam.

I. case. The grades range from 3 to 5, and the two middle grades are 4. In this case, there is definitely a 5. The average is worse the more bad grades there are, so taking this into account, the worst average can be obtained as follows:

$$
3 ; 3 ; 3 ; 3 ; 3 ; 3.5 ; 3.5 ; 4 ; 4 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 5
$$

or

$3 ; 3 ; 3 ; 3 ; 3.5 ; 3.5 ; 3.5 ; 4 ; 4 ; 4 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 5$.

(There cannot be fewer 4.5s, otherwise it would not be the mode.)

The average in both cases is $\frac{62}{16}=3.875$.

II. case. The grades range from 3 to 5, and the two middle grades are 3.5 and 4.5.

In this case, there is definitely a 5, and thus the grades that give the worst average are:

$$
3 ; 3 ; 3 ; 3 ; 3 ; 3 ; 3.5 ; 3.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 5 .
$$

(There cannot be one more 3, otherwise 4.5 would not be the mode.)

The average is $\frac{61.5}{16}=3.84375$.

III. case. The grades range from 2.5 to 4.5, and the two middle grades are 4. The grades that give the worst average are:

$$
2.5 ; 2.5 ; 2.5 ; 2.5 ; 3 ; 3 ; 3 ; 4 ; 4 ; 4 ; 4 ; 4.5 ; 4.5 ; 4.5 ; 4.5 ; 4.5
$$

(There cannot be more 2.5s or 4s.)

In this case, the average is $\frac{57.5}{16}=3.59375$.

IV. case. The grades range from 2.5 to 4.5, and the two middle grades are 3.5 and 4.5. The grades that give the worst average are:

$$
2.5 ; \quad 2.5 ; \quad 2.5 ; \quad 2.5 ; \quad 2.5 ; \quad 2.5 ; \quad 2.5 ; \quad 3.5 ; \quad 4.5 ; \quad 4.5 ; \quad 4.5 ; \quad 4.5 ; \quad 4.5 ; \quad 4.5 ; 4.5 ; 4.5
$$

The average is $\frac{57}{16}=3.5625$.

Based on these, the worst average is in the IV. case. In this case, there is no grade of 5, so Pista answered that he could not have received a 5 on his exam.

II. solution. We will prove that for every sample in which there is an excellent grade among the grades, there is another sample that does not contain an excellent grade and has a smaller average. If there is a 5, then there must be a 3 in the sample, because the range is 2. Replace one 3 with $2/3$ and all 5s with $4/5$: the range and the median do not change, and the mode remains 4/5. The sum of the grades definitely decreases, so the average also decreases. Thus, the sample with the smallest average definitely does not contain a 5, so Pista's answer was negative.

Note. Many did not justify why there is no grade of 5 in the worst case. Some thought that if they found a solution between 2.5 and 4.5, then the average of a case containing a 5 could not be smaller. This is true, but it is not at all obvious.