Ans $4)$
Program counting number of $1.$
It is given in question, that $n$ represent, binary representation for $n.$
Now, if we check 'while' loop, $b$ is increments it's value only when last digit of $n$ is $1.$ and then it is right sifting the value.
So, $b$ is returning nothing but number of $1's$ in $n.$