It was a imperial examination in Song Dynasty (later on), but in Han Confucianism was hella on, so u need dat knowledge to be in gov. A lot of goverment after Qin Dynasty (previous dynasty) was adopted. So the Emperor had all the power, and all the "jobs" cam down on familly line. So pretty much be wealthy, know confucianism, and have a father who was in the gov, or if the emporer chose u, and u must have a d!(k. Okey, just googled in wiki to be sure and it's says "the states made by the emperor were assigned to official dedication..." So I guess emperor chose the gov, but all of them had to be educated. Sooo if that helps, hard question though.
What qualified a Han dynasty citizen to hold a government post was the holding of a public contest.
Explanation:
The Hans then instituted a public examination service based on written examinations. Anyone who wanted a government office would be tested on the Chinese government laws that were based on Confucius' thoughts. Soon, scholars became the Chinese upper class. Most of them owned land. Farmers and peasants could theoretically become government officials, but this rarely happened because most of them did not have the financial resources to devote themselves to the studies required to pass the competitions.