In theory, government slots are open to everyone, whether noble or peasant, rich or poor.
In practice, higher-ranked people are more likely to know people with influence, and poorer poeople may be too busy feeding their family to afford to take the imperial examination.
But even so, poor people can still reach high ranks through talent or luck; Liu Bei, was a shoe-seller, Deng Ai was a farmer, and He Jin was a butcher, yet all three reached very high ranks.
I'd have to study things to be certain, but I have a feeling that advancement like this was more common in China than than in medieval Europe, simply because nobles in medieval Europe would marry other nobles (to the point where morganatic marriages were often a succession-breaking thing)
Unless I specifically say otherwise, assume I am talking about historical Three Kingdoms, and not the novel.