Step 1: Using the work equation for an isothermal process.
For an ideal gas expanding isothermally, the work done is given by:
\[
W = nRT \ln \left(\frac{V_f}{V_i}\right)
\]
Where:
- \(W = 5 \times 10^3 \, \text{J}\) (work done)
- \(R = 8.314 \, \text{J/mol·K}\) (gas constant)
- \(T = 300 \, \text{K}\) (temperature)
- \(V_i = 10 \, \text{m}^3\) (initial volume)
- \(V_f = 20 \, \text{m}^3\) (final volume)
Step 2: Rearranging the equation.
\[
n = \frac{W}{RT \ln \left(\frac{V_f}{V_i}\right)}
\]
Substitute the known values:
\[
n = \frac{5 \times 10^3}{8.314 \times 300 \times \ln \left(\frac{20}{10}\right)} = 3 \, \text{mol}
\]
Step 3: Conclusion.
The correct answer is (B) 3 moles.