Organization A needs 4000 addresses.
Now, 2^n>=4000 =>n=12
To get the mask for organization A, set (32-n)=(32-12)=20 bits to 1. Hence, mask=255.255.240.0
1st IP of A=198.16.0.0
Last IP of A:-
Set rightmost 12 bits of mask to 1 and perform bitwise OR with 198.16.0.0
Last IP=198.16.15.255. But, here, 4096 addresses are utilized, we need 96 less hence last IP of A=198.16.15.159
Similarly,
Mask for organization B=255.255.248.0
1st ip of B=198.16.16.0
Last IP of B=198.16.23.207
Mask for organization C=255.255.248.0
1st IP of C=198.16.24.0
Last IP of C=198.16.31.207
Mask for organization DATA=255.255.240.0
1st IP of DATA=198.16.32.0
Last IP of DATA=198.16.63.63