you will hear prolong beep sound when you boot your computer sytem and it will not boot up, means hardware malfunction. hang and unusable application software or crash in the middle of your work means there is a software malfunction. But system software (OS) you can easily determain it when malfunction because the computer itself will tell what is wrong with it. And there are process you should be done to fix it.
in terms of software is when the computer fails to boot completely and the screen appears black,hardware malfunction you have to consider many facts before a conclusion one does the computer power on, if it does you have to test the memories and the processor because sometimes it can be power failure
To detect Hardware malfunction: broken (physical appearance), doesnt have continuity, error sounds.
To detect software malfuntion: when u install a hardware and its not detected, detected but not functioning, incompatibility (softwared & hardware)