Get a copy of the Highway Code and read it several times.
Have a look at one of the online theory test websites, like this one:
http://www.theaa.com/drivingschool/theory-prac tical-driving-tests.html
and take some mock tests.
You have to take Hazard Perception Test and a Theory Test. In the Hazard test you have to get 44 out of 75 points, in the Theory 43 out of 50.
Now don't worry, these aren't too hard if you learn the books and think about what you're doing.
The main thing is to find a really good instructor. Talk to friends who have passed their tests to get recommendations, then try to meet the instructor before agreeing to spend time alone in a car with them. If you get on with them, you'll learn quicker than if you don't. Remember school?
As for buying a car, I'd wait until you're a good way down the road towards taking your test first.
Good luck