adding solution to question 1 and 2