It's very common in teenagers. Something about how the brain develops. Basically, when a developing teenage brain is confronted with something really shocking or traumatizing, it sort of shorts out and causes the person to laugh.
That's because even at 16 years old, the brain can't fully comprehend trauma like death, etc.