Car trn off when idling

My sister called me about trouble her car was having. She had the alternator replaced two weeks ago and was told the battery had a bad cell. Supposedly, water was added to the battery and it was ok for now. Recently, when she’s at stop signals for a while and stopped when shifting to drive in a parking lot, the car will turn off. I think it’s the battery as the car supposedly is ok while in motion. So, could a bad battery interfere in such as way to cause this problem or could it be something else, such as idle control or the O2 sensor? Any help would be greatly appreciated.

Umm, year make and model would be a BIG help here.
I can’t see how adding water to a battery with a bad cell would help it in any way, perhaps you meant one cell was low on electrolyte and they added water to top it up?

Anyway if the battery was bad enough to cause the car to stall, it would not start the car back up, I would rule out the battery for right now.
I highly doubt and O2 sensor could cause such a problem. A bad/dirty idle air control valve (assuming the car has one) or a dirty throttle plate can for sure cause stalling, along with a few dozen other issues.

Sorry, it’s a 1990 Toyota Corolla. Just called her and she clarified it was in motion when the car turned off when backing out in the parking lot. Also, at night, the dashboard and headlights are dim, but brighten when the gas is pressed.

Sounds like the alternator is not charging at idle speeds. Ask the shop that did the work to retest the new alternator and battery.