There are two different types of assessment, Formative and Summative, to consider when creating assessments for online course content. Depending on the type of course you may want to use one or the other or even both.
Formative feedback is usually immediate to help the learner through the learning experience and enables them to change their behaviour and understanding in a constructive way. For example, should the learner answer a question incorrectly they may be given a model answer or remedial training to understand the correct meaning and be reassessed later. Therefore, Formative Assessment is a very good method of assessment for improving student understanding and performance.
Summative Assessment tends to take place at the end of a large chunk of learning. However, this is a good example of an exam type scenario when a user can be assessed at the end of a course to monitor their achievement of learning outcomes and determine final grade/award. Also Summative Assessment could be used at the conclusion of a course.