(a) When a pencil is seen through a concave lens placed close to it, it appears smaller than it's actual size. Because a concave lens always produces a virtual image, the image formed is virtual.
(b) When a pencil is seen through a convex lens placed close to it, the image so formed appears larger than it's actual size. The reason for this is, the pencil is placed within the focus of the lens and therefore, the image formed is virtual.