The most common way your cat got tapeworms is from having fleas, which often carry immature tapeworms. Cats infested with fleas will frequently ingest them as they groom themselves (a daily behavior) and become infected with tapeworms. Cats that hunt small rodents (in your house or backyard) may also be at risk of infection from tapeworms.
Tapeworm segments look similar to grains of white rice and are easily seen stuck in your cat's hair under the tail or by the back legs, or in their poop. Of course, it's not always obvious that your cat has tapeworms, so the best way to identify a problem is through an exam performed by a veterinarian.
Luckily, one treatment with Tapeworm Dewormer (praziquantel tablets) for cats should be adequate to clear out the tapeworms. However, steps should be taken to treat and prevent fleas on the cat (and other pets in the home) and remove rodents around the home or premises in order to prevent reinfection; otherwise, retreatment will be needed.
WARNING: Keep out of reach of children.