How to avoid fluid appearing outside collision objects? In fluid simulation as it is done on a grid with a resolution definable even choosing a higher value for the resolution (as in our example below, 200) it is not enough to have a realistic shape of the simulated fluid with respect to the obstacle, here a glass.  


One may suggest that after simulation scale up the glass up to a size that the artifact disappear. This is a bad idea. The obstacle is not going to be a simple shape. Scaling causes many issues.
One may also suggest that trying to apply Boolean operation on the resulting fluid (domain) with the obstacle (here glass) e.g., applying fluid(domain)-glass. This is also bad idea as it will not remove parts of fluid on outer surface of the obstacle.


Is there any better way to do this: to generate a fluid that respects the surface of the obstacle in a more realistic way?


For those may suggest even higher resolution, please note that for just such a simple simulation shown in the figure, it consumes gigabytes for baking! If you could increase the resolution to infinity, yeah, this may solve!




Update:
Check the following example.
Left is what you get if you don't do anything.
Right is what you get if apply Boolean operation properly on stack.
We put this example here to demonstrate that clipping (which is very costly, BTW) may work only for simple situations as this example. It cannot be done for complex shapes. The results (after couple of hours) will be very disappointing. We believe something should be applied in more low-level during fluid simulation. Say, each frame (step or stage) of fluid simulation a post=processing should apply to match the grid output with the obstacles' surfaces.


  Only for simple situation like this
I can't comment, so:

Try to keep the size of the domain as small as possible, and as fit to the simulation as possible. That makes the simulation require less resolution. For example, if you pour liquid from a bottle into a glass, restrict the boundaries of the domain to the neck of the bottle on top, and on the bottom, to the table, if you wish to have drops fall on the table. The domain works like a third dimension matrix. The resolution allows for the cells that are inside it to be smaller (which gives more resolution) or larger, depending on the resolution. Which is why you must fit your domain to your scene as much as you can. Since the cells inside your domain are not small enough, they touch the glass and some of them leak out, since the cells are larger than the thin glass.

I also suggest that you try to use "volume initialization" set to "shell" on the obstacle fluid properties, which will change a lot of things (although it won't work miracles).

As you already know, the trick about precise liquids is the resolution of the domain. It's the only thing.

One example (Only 102 of resolution and domain subsurf):