"4SNS/1/40000000 TH0P" I believe is a fault at the hard drive temperature sensor. Possibilities would include a faulty temperature sensor, a faulty connection at the logic board for the sensor or a failing hard drive (resulting in an increase in temperature).
The file with a question mark icon is an indicator that the Mac can't locate a bootable operating system, either because of hardware failure or operating system corruption.
Seeing these two errors occur at the same time would lead me to think that the hard drive is failing, causing an increase in temperature (triggering the 4SNS/1/40000000 TH0P error in AHT) and leaving the iMac without a bootable operating system. I would first replace the hard drive, reinstall an operating system and then, once the machine is booting again, re-run AHT to verify that the 4SNS error is no longer present. If the error is persisting then I would try to replace the hard drive's temperature sensor, re-running AHT again to verify that the issue is resolved.
One note though, AHT is loaded on the hard drive from the factory. When you replace the hard drive (or completely erase and reinstall) you lose the built in copy of AHT. The iMac's original gray restore discs should have it along with instructions on how to run it from a disc. If the original discs are lost you may be able to find a download for it from Apple, I believe the specific version for your iMac is AHT 3A113.
Hope that helps!