I don't know how the cable system works either, but if it's anything like the phone system there'll be a distribution cabinet somewhere in your neighbourhood whose job is to split out the signal from the main trunk down to all the individual houses. If that cabinet loses power then you've lost your cable regardless of what you do in your own house. I would at least ask the question of your cable provider if this is likely to work before you shell out for a possibly useless UPS.

By the way, how long are the power outages we're talking here? If it's a couple of minutes then powering the modem and router via UPS would be easily done. If it's a couple of hours then things get trickier, because you need to make sure the battery capacity of the UPS is sufficient to see you through.