Question: how to know whether battery or alternator?
Answer: If the engine starts but dies immediately, your alternator probably isn't keeping your battery charged. If a jump starts and keeps your car running, but the car can't start again off of its own power, a dead battery is likely your answer.