(D) Let the downward direction be positive $(+)$ and the upward direction be negative $(-)$.
For the ball dropped from the building $(1)$: Initial velocity $u_{1} = 0$. Acceleration $a_{1} = g$.
Velocity after time $t$ is $v_{1} = u_{1} + a_{1}t = gt$ (downward).
For the ball thrown up $(2)$: Initial velocity $u_{2} = -40 \, ms^{-1}$ (upward). Acceleration $a_{2} = g$.
Velocity after time $t$ is $v_{2} = u_{2} + a_{2}t = -40 + gt$ (downward).
The relative velocity of ball $1$ with respect to ball $2$ is $v_{rel} = v_{1} - v_{2}$.
$v_{rel} = (gt) - (-40 + gt) = gt + 40 - gt = 40 \, ms^{-1}$.
Thus,the relative speed of the balls is constant at $40 \, ms^{-1}$.