In practice, guessing the focal length of a lens by size isn't quite accurate because lenses are not as simple as a diagram may show you, here's a good tutorial on the subject: http://www.bobatkins.com …asuring_focal_length.html
However life is not so simple with a camera lens. You can still focus an object at infinity OK, but what distance do you measure? From the focus to the back of the lens, from the focus to the front of the lens or from the focus to the middle of the lens? The answer is no to all three questions. You actually measure the distance from the focus to something called the rear (or secondary) nodal point of the lens. The strict definition is:
Assuming that the lens is surrounded by air or vacuum (refractive index 1.0), the focal length is the distance from the secondary principal point (which in this case is also the secondary nodal point) to the rear focal point of a lens.
Where is the "rear nodal point"? Well it could be anywhere. It could be somewhere inside the lens, it could be out in front of the first element of the lens (for telephoto lenses) or it could be somewhere between the last element of the lens and the focus (for wideangle retrofocus lenses).
The complex optical formulas of modern lenses really screw around with these things, so it's something you'll have to calculate yourself, or ask the lens engineer who designed it. Also, the focal length of lenses changes as you focus, unless there is a built-in system to compensate for this as in those high-end lenses used for video and film.