A 20 newton weight is attached to a spring, causing it to stretch, as shown in the diagram below. What is the spring constant of this spring?

A 20.-N force stretches the spring by 1.00 m - 0.50 m = 0.50 m, so by Hooke's law the spring constant is k such that
20. N = k (0.50 m)
⇒ k = (20. N) / (0.50 m) = 40 N/m