code for question 1