The torque created by a force that is applied is equal to T = f*d*sin x, where f is the force applied, d is the distance between the point where the torque is being measured to where the force is being applied and x is the angle between the displacement vector of the line joining the point where the force is applied to the point where torque is being measured and the force vector.
In the problem, a torque of 30 J is required to loosen the rusted bolt. A wrench with a length L is used to apply a force of 40 N at an angle equal to 90 degrees. This gives:
30 = 40*L*sin 90
=> L = 30/40 = 3/4 m
The length of the wrench is 75 cm.