Hardware issue on iMac, flashing question mark
If you see a folder with a question mark appear instead of the Apple logo, it means your Mac couldn't find a local or network-based startup disk. This can happen if the disk selected in the Startup Disk pane of System Preferences isn't available. Wait a few seconds to see if your Mac is able to locate the startup disk you specified. 

If you still see a question mark after waiting a few seconds, use Startup Manager to start up your Mac, then select your startup disk from System Preferences.

If a question mark appears after you install a software update, select your startup disk again using macOS Recovery (Power off Mac, then power it on while holding Command+R until you see the Apple logo).

Reference: https://support.apple.com/en-us/HT204156