Exercises 6 and 7

Signed-off-by: Salil Kanitkar <slashforu@gmail.com>