The mean \( \bar{X} \) of a frequency distribution is given by:
\[
\bar{X} = \frac{\sum f x}{\sum f}
\]
where \( f \) is the frequency and \( x \) is the class midpoint.
For the given classes, the midpoints are:
0–10: \( 5 \), 10–20: \( 15 \), 20–30: \( 25 \), 30–40: \( 35 \), 40–50: \( 45 \).
Using the formula:
\[
23.8 = \frac{7(5) + 5(15) + 3(25) + 4(35) + k(45)}{7 + 5 + 3 + 4 + k}
\]
Simplifying and solving for \( k \), we get \( k = 6 \).