We say “Careful!” dozens of times a day, and children still don't know what to be careful about. A quick warning only says something's wrong – it doesn't say what to do.
A question works differently. “Where will you put your foot?” or “Will that branch hold you?” makes your child stop and judge the situation themselves. It's practice they'll need when you're not right there.