Code for exam1