How does viola jones algorithm cope up with a test image size which is very different to training image sizes? To my understanding Viola jones algorithm is a combination of weak classifiers built on training imageset. Lets say we have training images of 24x24 and algorithm selected 100 haar features and built a classifier. Assume there is a test image which is of size 512x512 and there two persons(just faces) in the image one person(100x100 size in 512x512) closer to the camera and the other(10x10 size in 512x512) at a distance.  


How does viola jones detect faces detect both persons having learnt
features      features for faces that fit in 24x24?
Is the algorithm implemented in libraries in such a way that haar
features vary depending on the size of the image
I think you are talking about multiscale object detection. It will rescale the images to different resolution and then use trained classifier over it.