Solve question 1 of assignment 4