Answer
a: The work needed to stretch the spring from 35cm to 40cm is $\frac{25}{24}J$
b: $30N$ can push the spring $10.8cm$ away from the natural length
Work Step by Step
Before we can solve any of these questions we need to find the spring constant
We are given a force of $2J$, a natural length of $30cm$, and an extended length of $42cm$
For convenience, we will convert centimeters into meters
The spring is being pulled $12cm$, or $0.12m$
$2=\int^{0.12}_{0}(kx)dx$
$2=[\frac{kx^{2}}{2}]^{0.12}_{0}$
$2=\frac{k(0.12^{2})}{2}$
$4=k(0.0144)$
$\frac{2500}{9}=k$
Now since we know the spring constant, we can now solve the questions
a:
Spring is being pulled from $0.05m$ to $0.1m$ relative to the natural length
$W=\int^{0.1}_{0.05}\frac{2500}{9}dx=\frac{25}{24}J$
The work done is equal to $\frac{25}{24}J$
b:
$30=\frac{2500}{9}x$
$x=0.108m=10.8cm$
$30N$ will stretch the spring $10.8cm$ away from the natural length