Try different values of x to observe the behaviour of p(x).
x=0: p(0)=0, because 40 mod (x+4)=40 mod 4=0.
x=1: p(1)=k+24, because 40 mod 5=0. If k+24=-28, then k=-52.
x=-1: p(-1)=5-k, because 40 mod 3=1. If 5-k=-28, then k=33.
x=2: p(2)=8k+74, because 40 mod 6=4. If 8k+74=-28, then k=-102/8=-51/4.
These give different values for k, so there is no single solution for k. However, if the question is supposed to read: p(x)=(kx^3+15x^2+9x-40) mod (x+4)=-28, the situation is quite different.
Using synthetic division, we can work out the remainder: -64k+164=-28. The modulo function only requires the remainder, which we know is -28; therefore 64k=192 and k=3.
Details of division:
-4 | k......15..........9...........-40
......k.....-4k 16k-60 -64k+204
......k 15-4k 16k-51 -64k+164 (=-28)