Can I direct you to this answer also(perhaps for the second question you ask):
What does it take to become a registered Animagus?
For the first part:
We know that you start learning about Animagi in 3rd year Transfiguration, and it was probably then that James and Sirius got the idea to become Animagi to accompany Lupin. In the same way that you could learn how to make a Horcrux, or Polyjuice potion from library books, there would most likely have been a book on Animagus. Having access to the cloak, they could easily have read the books they needed to (even at night or if it was in the forbidden section), and once they got the basics correct, would just require practice.
Harry chose a seat right at the back of the room, feeling as though he were sitting in a very bright spotlight; the rest of the class kept shooting furtive glances at him, as though he were about to drop dead at any moment. He hardly heard what Professor McGonagall was telling them about Animagi (wizards who could transform at will into animals), and wasn't even watching when she transformed herself in front of their eyes into a tabby cat with spectacle markings around her eyes. - PoA
And add the fact that Victor Krum, as a 7th year, attempted a form of crude animagus by transfiguring himself partially. It was only to the point that he could partially transform, but Krum was seen as quite a powerful wizard for his age (Worthy enough to join the Triwizard Tournament, International Quidditch Player, ability to cast an unforgivable curse). If we consider Sirius and James to be more gifted than he was, then it is fully possible that they could have learnt it in 3 years successfully, as opposed to him learning a crude form in a few months. Also, he (Krum) was always spending his time in the library, so you could argue that he learnt it from a book in the Hogwarts library, and practised it in the lake when he was swimming.
It was Krum. He appeared to have transfigured himself but badly.- GoF
And the quote below to show he may have been practising a month at least beforehand in the lake.
As they passed the Durmstrang ship moored in the lake, they saw Viktor Krum emerge onto the deck, dressed in nothing but swimming trunks. He was very skinny indeed, but apparently a lot tougher than he looked, because he climbed up onto the side of the ship, stretched out his arms, and dived, right into the lake.
"He's mad!" said Harry, staring at Krums dark head as it bobbed out into the middle of the lake. "It must be freezing, it's January!" - GoF
So, Sirius and James could have learnt from a book the theory like Krum did, and then just undergo lots of practice in order to get the right transformation after 3 years.