If you observe the rules only in letter, it means that you do exactly what is written as a rule, but maybe you are still not being completely honest and scrupulous.
If you observe the spirit of the rule or law, then you are being completely honest about it.
A student can sit an exam, do an exam or take an exam - the meaning is the same.
A teacher gives an exam to his/her students.
I'm not sure what you mean by 'the end thing' - what was the context?