If the PC detects an error during startup, it usually emits beeps. Depending on the number of beeps, the error code can be found in the bios documentation.
These are errors like no keyboard recognized, main memory error, hard disk error, boot sector not found, boot hard disk not found, too high CPU temperature, if the cooling doesn't work anymore etc..
Maybe a virus has damaged the PC.
For a test on RAM errors you can create a bootable USB stick and test the RAM with memtest86.
https://www.memtest86.com/
There are also boot CDs of various Linux distributions that have memtest86 built into their boot menu. You can use that too.
For a reliable RAM test, the tool must run for a few days in 24-hour operation. I once had a case where a memory error occurred only after a week (a PC dealer tested it for that).
If the voltage supply is no longer guaranteed and the battery on the Mainboard is empty, then the BIOS forgets the settings, such as boot medium, installed memory and other important settings.
In this case, you have to activate the BIOS at startup and possibly correct the settings yourself. But you have to be familiar with this.
The cause of the error can be very complex. This should be investigated by a person who has a lot of experience in the PC self-assembly.
Sorry for my bad english