The lens have to have Nikon's F-mount to mount directly to a D5200.
You can use other mounts, like Pentax K-mount or lenses that have M42 threads, by putting the correct adapter between the D5200 and the lens.
Older Nikon CPU lenses that don't have an auto focus motor in them still transmit distance information to the auto focus module in a D5200.
There is just no way for the camera to drive the AF mechanics in the lens.
So you do that for the lens by turning the focus ring on the lens.
The camera doesn't care that it's you moving the focus ring and will light the In Focus indicator in the viewfinder when you have achieved focus manually.
The D5200 also has a function called Rangefinder that will show you which way you need to turn the focus ring to achieve focus. See page 159 of the D5200 Reference Manual.