Laptops shutdowns automatically first hangs then switches off itself

The laptop hangs, keyboard and scroll pad doesn’t work and waits for some time and then I hear a beep sound and it turns off automatically. I do not understand what happening. Assume I am working on MS office in laptop, with no other tasks running in background, all of a sudden first MS office will become blur, kind of indication that it is stuck, then later entire windows stuck. It doesn’t respond for control alt and delete too. Either I have to forcefully shut it down or wait for itself to turn off after a beep. How to resolve this. Laptop gives full performance when it is running. Isn’t that the good hope?
