How to go about encrypting a digital exam? I'm building a Digital Examination system and I'm having problems understanding some concepts in cryptography.

I want use to Asymetric Cryptography and my questions are


Do I encrypt the entire file?

When I do my encryption is it that I should make the entire file encrypted with the private key of the sender of the exam? (as it passes through different hands e.g. lecturer to exam department)

Or do I just generate some kind of code that the recepient would compare it to?
Is that what digital signing is?
Do I need a public and private key for every party the exam passes through? 

(lecturer, student, exam dept etc)
Let's see if we can clear up some of the basic crypto concepts for you. (Though you should probably do a bunch more reading on your own, and maybe hire a crypto consultant if this system is more than just a course project. Sloppily done crypto can get an institution into big legal trouble.)

Public Key Encryption:

In public key encryption, you encrypt something with the recipient's public key, so that the recipient can decrypt it with their private key. Think of it like a mail slot in your front door: anybody can send you stuff by slipping it through the slot (ie encrypt with public key), but only the person who lives there can unlock the door and get it (ie decrypt with the private key). -- The idea of "encrypting with the private key of the sender" does not make any sense - you push it out the mail slot so anybody walking by your porch can look at it?

For your second question:


  2.Do I need a public and private key for every party the exam passes through? (lecturer, student, exam dept etc)


If you want all of those people to be able to read it, then yes, you will need to issue each of them keypairs and have a system like this:

Person A encrypts for person B --&gt; Person B decrypts then re-encrypts for person C --&gt; Person C decrypts then re-encrypts for person D --&gt; etc

(Note that a scheme like this would be considered insecure in any other setting because any of those people could modify the exam before re-encrypting it, and there's no way to prove who changed it. So this likely isn't what you want either.)

System design:

In my opinion, the proper way to do this would be to assign every student a keypair - maybe attached to their user account? Or maybe every exam invigilator gets a keypair if that makes more sense. Then your central server encrypts N copies of the exam: one per student / invigilator. If there are intermediary people who need to see it (lecturer, dept, etc) then you make a copy encrypted for their keypair also. This way, once you encrypt a copy of the exam for Student X, then regardless of how many hands it passes through, only Student X will be able to open it. This is the type of usage that Public-Key encryption is designed for. (As a side note: this would work very well if each copy of the exam had a random number embedded in it so you know that Student X is handing in their copy of the exam, not their friend's copy.)

Edit:

Looking over your question again, the line


  Or do I just generate some kind of code that the recepient would compare it to? Is that what digital signing is?


doesn't fit with the rest of your question. Signatures are an anti-tamper system: they guarantee that this is the original document, and hasn't been modified, but does nothing to hide it (ie everybody can see the text).