"Five parts of the examination" simply indicates that you are describing certain "five parts" of the examination. The examination can have 10 parts in total, and saying "5 parts of the exam" will still be valid in that case.
"Five parts to the examination" indicates that the exam has exactly five parts, nothing more, nothing less. I cannot think of another example where you can use "to" other than your example sentence. In a way, the sentence is equivalent to "The examination is separated into five parts".
"Five parts in the examination" is a little more versatile. You can use it in this same sentence, to mean that the exam has exactly five parts. You can also use it to describe five out of ten parts in the exam, where "to" is generally not used in that case.