Anonymous: Be thankful you don't work there if this is how they treat potential new hires. If you live in the US there's nothing you can do about it — so my suggestion is to move on and learn from YOUR mistake.
Or just see it as, who cares no point worrying over it. They found a better candidate the test was probably just a small factor in who they hire.
Nothing you can do. On to the next one.
Why do you think the exam they sent was an accident?
If they replied to your query they did not ignore you.
As a software engineer you will encounter things that you do not expect or do not fully understand. How you respond to, and deal with, such problems is the test.
Programming is about thinking not typing code.
Regard it as test the employer had to take in order to deserve to hire you. They failed.
You screwed up and didn't correct the issue in time. Just keep that in mind and correct errors ASAP.