Let x be the grade of the last test, then the average would be:
[tex]\frac{77+88+74+x}{4}=\frac{x+239}{4}[/tex]This has to be at least 80, then we have:
[tex]\begin{gathered} \frac{x+239}{4}=80 \\ x+239=320 \\ x=320-239 \\ x=81 \end{gathered}[/tex]Therefore the last test has to have a score of at least 81 to get a B.