Sample space for knowing whether it is a boy or a girl.

Let $B_1$ and $B_2$ denote the first and second boy and $G_1$ and $G_2$ denote the first and second girl respectively.

$\therefore$ The different possibilities are both the babies are boys (i.e) first baby is a boy and second is a boy,first baby is a boy and second is a girl,first baby is a girl and second is a boy,first and second baby both are girl.

$\therefore$ The sample space $S=\{B_1B_2,B_1G_2,G_1B_2,G_1G_2\}$