We have a total of $Q$ bins that we can put pairs of socks into. The bins are numbered $1,\dots , Q$. The pairs of socks are put into the bins at random with probability $p=1/Q$. If we assume that there are a total of $M$ pairs of socks, what is the probability that there are $N<M$ socks in the $qth$ bin, and the $(M-N)$ rest of the socks are in the $(q+1)th,\dots , Qth$ bins?
First find total possible arrangements $A$. Then determine total number of ways $B$ of achieving the condition in the problem as number of ways of choosing $N$ pairs out of $M$ pairs for putting into bin $q$ times number of ways of putting the remaining $M-N$ pairs into $Q-q$ bins. Required probability will be $B/A$.