There are typical job interview questions/test like:
I don't fully understand why job interviewers do those kind of tests. Well I quite understand that if you want to work for Google, Facebook etc you need to have those skills.
Because they need to know if you only learned schemes or you can be creative and put something together on your own :)
Jan Vladimir Mostert
Idea Incubator
I've interviewed many developers and more often than not, people lie or exaggerate about things on their CV.
I asked a potential QA engineer several years ago (who claimed that they're an expert at Selenium), Me: "How well do you know Selenium, I see you rated yourself an expert", QA: "I use selenium all the time", Me: "explain how you set it up and how you used it", QA: blank stare, Me: "how do you click on a button using selenium, what would your selector look like?", QA: "I'll need to Google that", Me (getting a little bit annoyed that somebody claiming to be an expert and using it every day can't answer the simple questions): "Do you actually use Selenium", QA: Shock of horror expression, the candidate couldn't believe I just broke through their bullsh#t barrier and responded, "no, but my team mates are using it and I can always just Google it"
Using the above as an example, by turning up the tension / heat, I broke through their barriers and exposed them and saw them for whom they are instead of what they say they were.
Getting back to your example, if I had to interview you, you could tell me anything and I wouldn't have a clue how to verify if what you're saying is spot on, lies or exaggerations. By throwing difficult questions at you, I first of all see if you can think and how you solve problems (if you can't solve problems, you're not a very good developer and this will reflect in the type of salary offer made if you pass the character test); second, I see how you respond to bombshells being throw at you, do stay calm and focussed, do you communicate how you're solving the problem, do you make untrue assumptions, do you have a methodology for solving problems, or do you panic, freak out and freeze?
If you can't solve problems, then chances are you will be a liability on somebody else's time if you're given a task to do that is not straight forward - that's what developers do, solve problems for business.