The rifle and the bullet make a system. Since, there is no external force acting on it the momentum of the system should be conserved.
∴m1u1+m2u2=m1v1+m2v2
⇒4×0+(50100)×0=4v+501000×35
⇒4v=−3520
⇒v=−3580 m/s
Note:- Negative sign indicates that recoil velocity is opposite to the motion of the bullet.