This exercise (and the following one) have been taken from the excellent book 'Test your prepositions' by Peter Watcyn-Jones and Jake Alsop (Penguin English). I would recommend all learners of English at the intermediate level and above to buy a copy of this book and its sister edition 'Test your phrasal verbs'.