Solved chapter 2 exercises