Although in this extreme case it does sound like checking stackoverflow is considered cheating.
This is hardly a new concept: exams work pretty much the same way. There are other ways to assess candidates (like looking at their portfolios), but they have their own weaknesses, and testing skills in a constrained environment can still reveal things.
[1] And this is for the benefit of both parties: I've lost count of how many people I've heard complain about companies that have gauntlets of technical interviews.
This is the core problem with tech hiring circa 2016. The sooner this idea dies, the better. It's surprising that more companies haven't noticed the most effective interviews are ones that resemble the company's day-to-day work as closely as possible.