The expense and time for study excluded many people and I have heard that whole villages would pool resources for just one son to buy the exam materials and take the time to study for the exam. Richer families didn't have need to sacrifice as such, of course. Typical success ratios were ~1:50 exam sitters. The Taiping rebellion was a direct result (among many) by such a man that failed his exams a few times (later declaring himself the brother of Jesus, but that's whole other story).
Though exam subjects changed over time, it typically included recitations of Confucian poetry, calligraphy, instrumental music, and other such gentlemanly subjects. You know, things you really need your bureaucrats to know to run an empire well.
Similarly with FAANGs (and previously with GMC/Ford/Chrysler, or in academia), the interview/exam is geared not towards the actual specifics of the job, but rather in the 'pruning' of the people and the appearance of legitimacy. They are selecting for people that will go through the hoops and the nonsense without questioning it and will make good bureaucrats (loyal, command-able, lacking vigor). Boat-rockers are selected out before they even start the irrelevant studying process.
Subjecting such person to a CS exam totally unrelated to what they will be doing (such as project management and leading a team of developers) is a complete waste of time for both sides and you still don't test whether that person has the skill they will actually need for the job.
But yay, you have found that they are great at inverting a tree or designing a complex hashing scheme at the whiteboard under pressure. Exactly what your company needs. Not.