Do exams actually work?

Today I had my Cambridge Advance english exam. I essentially sat down for a few hours while rewriting words to change the meaning of sentences, writing essays and proposals and extracting conclusions from texts & audios. I got out thinking well, that was nice but it totally didn't measure my actual knowledge of English.

See, my knowledge of English doesn't depend on memorizing the structure of a proposal. If I ever need to write one, I can pull out my phone and search for it. It also doesn't depend on the number of phrasal verbs I remember to write on my essays or on my luck with getting a theme where I can use the vocabulary I memorized.

If I was to design a method to measure the knowledge of Spanish (my mother tongue), I'd simply make them spend a few months on Spain. If they manage to survive, they know Spanish.

Of course, this isn't feasible for everyone due to a big list of reasons, but we should keep it in mind when designing exams. People are learning for a reason, so if we're gonna examine them, let's focus on how close are they from achieving their objectives rather than measuring their memory.