What they're actually testing for during the in-person interview is your ability to be a good worker bee. They're filtering out people like you who would question the point of doing task X. They want people who will do task X without question. They don't want workers who will ask "Why are we doing task X? Shouldn't we do task Y instead?" For most positions at these large companies, the person who questions the efficacy of task X is a different role -- the role that is instructing you to do task X.
With these trivia questions, they are in fact telling you as a prospective employee the kinds of tasks you will be doing. They are letting you know that you will be doing a lot of pointless work, you won't have any say in the work you will be doing, the work you will be doing will seem trivial to you, and you have to be okay with that. If you're not okay with that, it's not the job for you.
The best screening I ever went through was for a job where I'd be working on a Spring Boot app with a React frontend. For that screening, I was asked to add a simple feature to an example app.
It was clearly toy code, so I knew they weren't trying to get free work out of me. It was also representative of the kinds of tasks I would be doing, which let me know that I would enjoy the job, and let them know I would be good at it. I was hired on the spot.
I've written algorithms to reverse b-trees, and I could figure it out again if I had to. But I don't have to, because the standard library is a thing, and that task tells a potential employer nothing about my skill set.