Part of their job is simply to determine that you are who you say you are. They do this every day - within reason I expect they can ask you any arbitrary question related to you and your life to observe how you respond. They just want to catch those out that aren't, for whatever reason, being genuine about their story. I think there's a false assumption here that somehow @cyberomin's ability to actually _solve_ a BST was in some way tied to his likelihood of entry. That's obviously ridiculous. I imagine his response was still genuine enough that they believed him. Frankly as another commenter joked, I think they could have asked him to prove P=NP. It's when you reply confidently with an 'obvious' solution that they might raise an eyebrow.
Yes it would be unreasonable if their ignorance actually lead to you being denied entry. But in not one of the experiences here, or with @cyberomin, was that actually the case. The thing is, of course, that they're aware of their ignorance and the absurdity of their questions. You see, they know that they're bluffing. That's kind of the point.
It is, perhaps rather unfortunately, part of their job to make you feel uncomfortable, ask probing questions and weed out inconsistencies in your responses. Isn't that part of professional questioning? I can understand the frustration at the abruptness of the questioning, and it's hardly a friendly welcome. I've been angered leaving immigration before and I have to remind myself that ruffling my feathers is all part of the act. When first complaining to a friend she asked, "what did they insult you or something?" Actually, no. They just asked me lots of questions.
Clearly I'd like to think some questions are off-limits - I know there have been justified concerns about this - especially recently. And I understand this is hot topic right now - precisely why I think we should be careful - more careful than ever - not to overreact. From what I observe: The guy arrived, he was asked questions about his profession, his answers were evidently sufficient and he was let in. It happens to thousands of people every day. Honestly? I don't think there's a story here.