but how does it determined?
are the officials at the university those who decide if you have a first or second?

Each exam you sit, you get given a mark. The average is then taken of all the exams you've sat during you degree (using some weighting which normally makes the final year worth more than the second year). If you're weighted average is 70% or over, you are given a first class, 60% or above is an upper second, etc. Officials only come in and decide which class you are given if your average is on a so called "borderline" e.g. an average of 69% (or in some cases 68%). They will usually look at some exam papers to determine whether to award you the higher class or not, or sometimes they will give you an oral exam (this is usually just in arts subjects though I think).

i meant for someone who is outside uk and also learning outside uk who wants to start graduate studies at the uk.
i looked for example at the casm programme in cambrdige, and there are the entry requirements:
"Entrance Requirements
The Certificate is not an easy course. Non-Cambridge graduates are normally required to have a first class honours degree in mathematics, physics, or engineering, or an equivalent qualification. Candidates from within Cambridge are normally required to have obtained first class honours, or very good second class honours."

i meant for someone who is outside uk and also learning outside uk who wants to start graduate studies at the uk.
i looked for example at the casm programme in cambrdige, and there are the entry requirements:
"Entrance Requirements
The Certificate is not an easy course. Non-Cambridge graduates are normally required to have a first class honours degree in mathematics, physics, or engineering, or an equivalent qualification. Candidates from within Cambridge are normally required to have obtained first class honours, or very good second class honours."

does it include also those who learned outside the uk?

No, as far as I know there is no standard way to convert from degrees outside the uk to degrees from UK institutions. However, that does not mean that UK institutions do not take on grad students from abroard. I would suggest that if you want to study part III at Cambridge, you email their admissions tutor, since he will know the comparisons between UK degrees and the degree you have obtained in your home country. I would say that to get into part III, however, you would need to be near the top of your class, since it is a very popular course, and is, apparently, very difficult.

Anyway, I suggest you email the admissions tutor and ask him, as he'll be able to give you definitive advice whilst I can only speculate!

As most UK courses are now marked in terms of units, from which you obtain credit points. If you have, say, 140 points and need 120, you can "lose" two 10 credit point courses or one 20 credit point course.

As most UK courses are now marked in terms of units, from which you obtain credit points. If you have, say, 140 points and need 120, you can "lose" two 10 credit point courses or one 20 credit point course.

Ahh right. I've never come across anyone taking more than 120 credits though. In fact, I wanted to this year, but was told it was impossible (I only wanted to take 125 credits as well!)

Who gets a 1st (forget the honours part, that is neither here no there - it is for instance impossible to not get honours at some universities unless you really try) is entirely down to the university/department/school. As a rough guide imagine it is the top 15-25% for most subjects depending on how bastardish they feel (near 30% at cambridge for maths) in that particular year at that particular university doing that particular degree. (the idea it requires 70% exam mark is nonsense, since the exam marks are scaled after the fact to make 70%, or some other number plucked at random from the air, the required mark.)