... Honestly I don't understand why I failed at 150 questions the first attempt and passed at 100 questions in my second attempt:-)
The test ranges from 100 to 150 questions. The length varies depending on how well you are doing. Testing stops once it knows for sure if you will pass or fail. Kinda like the way a baseball game does not necessarily play the bottom of the 9th.
If you finished at question 150, you just barely passed/failed. If you finish at 100 questions, you passed/failed by a wide margin. I don't know the actual ranges, but think of it like this:
So in your case, it sounds like your first attempt taught you to how to more effectively study and/or take the test, resulting in a much better score. Good job.