Algorithm quiz question 5

i am not able to understand how it gives this output . pls explain in details