What number best replaces the question mark?

Also, if anybody has any idea what test this puzzle comes from, PLEASE tell me