Google does not work in real time; they have algorithms for how often and how deeply for various sites, but the specifics are of course a trade secret.
StackExchange as a whole seems to get re-indexed very regularly, multiple times per day, but because of the multitude of problems that can prevent a website from loading correctly— congestion in different parts of the Internet, failures of various server and network hardware components; bugs in the web server software, the application server software, the database server software, etc. ad infinitum— a URL that returns an error is not going to be deleted immediately. It will be revisited periodically to see if it is available again, and only after an algorithmically-determined amount of time when it remains unavailable will it be demoted or deleted.