Solved chapter 6 exercises