try this:
turn on computer, go into bios, go to temperature sensors, wait and see what happens (note the temps and whether or not it reboots). if it doesn't reboot for like an hour or so and cpu temps seem normal then it could be viruses. if temps are normal and it reboots then it's some sort of hardware failure
also, are you beep codes normal?