And that's OK, but in order for companies to make progress, they use questions like these to make sure they are hiring people that are knowledgeable and capable of solving certain kinds of problems. The other thing is, people that can answer these simpler kinds of programming problems correct are more likely to write clean code, make better decisions, and be an asset to a team. It is just an easy way to weed out bad candidates. That doesn't mean all candidates who can't answer the question are bad, but likely that all bad candidates cannot answer the question; there's a big distinction there.
Unfortunately a lot of people with good experience get left behind. But the other problem is just because somebody has good experience doesn't mean they are the right fit for the position. And that's just life.