In a class of 40 students, the ratio of boys to girls is 3:2. This means there are \(\frac{3}{5} \times 40 = 24\) boys and \(\frac{2}{5} \times 40 = 16\) girls.
The average marks scored by boys is 42, so the total marks scored by boys is \(24 \times 42 = 1008\).
The average marks scored by girls is 46, so the total marks scored by girls is \(16 \times 46 = 736\).
The total marks scored by the whole class is \(1008 + 736 = 1744\).
The average marks scored by the whole class is \(\frac{1744}{40} = 43.6\).
Let the number of boys be $3x$ and the number of girls be $2x$.
Since $3x + 2x = 40$, $x = 8$.
There are 24 boys and 16 girls.
Average = $\frac{(24 \times 42) + (16 \times 46)}{40} = 43.6$.