You must also be traveling at a speed where if you need to stop suddenly, you can do so safely without causing a car accident; however, depending on the state you live in, different rules may apply. You may be found partially at fault because your stalled vehicle created a road hazard. Although the rule of thumb is that you must keep a safe distance between you and the car in front of you, the other driver can try to prove that they acted reasonably under the circumstances and had no choice but to rear end you.
If the stall happened suddenly in traffic, was caused by inexperienced driving and no warning signals were used, the other driver may have a solid case to prove that you were the one at fault for the car accident.