In a country in which people only want boys, every family continues to have children until they have a boy. If they have a girl, they have another child. If they have a boy, they stop. What is the proportion of boys to girls in the country?

Need to solve by forming Probability Density Function and then taking the expectation

The unstated premise seems to be that families can continue to try to have a boy indefinitely, and they will eventually have one before the "survey" for the statistics is done. While biologically impossible, we can accept the premise mathematically.

The

proportion of boys to girls presumably means the ratio of the number of boys to girls found in the survey, a random variable.
But this ratio is either undefined or [$]+\infty[$] (depending on how you want to label the case) for families with 0 girls. By ppauper's reasoning, this case has probabilty 1/2. So, if we follow your instructions and take the expectation of the pdf of this ratio, we either get "undefined" or [$]+\infty[$] for the answer.
In "real life", dropping the premise, the expectation of this ratio will be "doubly" undefined, since both 1/0 and 0/0 ratios will occur with strictly positive probability.