Need help to understand the output of the code