Since 10 N force is required to stretch through 1 mm
$k=\large\frac{Force}{extension}$
$\quad=\large\frac{10}{10^{-3}}$
$k=10^4\;N/m$
$E=\large\frac{1}{2}$$kx^2$
$\quad=\large\frac{1}{2} $$\times 10^4 \times (40 \times 10^{-3})^2$
$\quad = 8\;J$
Hence d is the correct answer.