5.6. testgrading.fmsl
module TestGrading;
import TestTaking.AnsweredTest;
import TestTaking.AnsweredSection;
import TestTaking.AnsweredQuestion;
import TestTaking.MultipleChoiceAnswer;
import TestTaking.MatchingAnswer;
import TestTaking.FreeResponseAnswer;
import TestTaking.CodeAnswer;
export GradedTest, GradedSection, GradedQuestion;
(* OBJECTS *)
object GradedTest extends AnsweredTest
components: gs:GradedSection*, grade:integer;
description: (* This is a complete graded test
that which contains the student's answers, the assigned score,
and comments added by the grader. By inheriting AnsweredTest
a GradedTest already contains the correct answers specified
by the author of the test/question as well as a the student's
answers given during testing.
*);
end GradedTest;
object GradedSection extends AnsweredSection
components: gq:GradedQuestion*, grade:integer;
description: (* contains the list of GradedQuestions
forming this section of the AnsweredTest as well as any Section
attributes inherited from AnsweredSection
*);
end AnsweredSection;
object GradedQuestion extends AnsweredQuestion
components: MultipleChoiceGraded or MatchingGraded or
FreeResponseGraded or CodeGraded;
description: (* Contains a graded question *);
end AnsweredQuestion;
object MultipleChoiceGraded extends MultipleChoiceAnswer
components: grade:integer, comment:string;
description: (* Adds a grade and comment to an answered
multiple choice question which includes single answer,
multiple answer and true/false questions.
*);
end MultipleChoiceGraded;
object MatchingGraded extends MatchingAnswer
components: grade:integer, comment:string;
description: (* Adds a grade and comment to an answered
matching question.
*);
end MatchingGraded;
object FreeResponseGraded extends FreeResponseAnswer
components: grade:integer, comment:string;
description: (* adds a grade and comment to an answered
free response question which includes essay questions,
short answer questions and fill-in-the-blank questions.
*) ;
end FreeResponseGraded;
object CodeGraded extends CodeAnswer
components: grade:integer, comment:string;
description: (* adds a grade and comment to an answered
code question which include both full programming questions
and short line fill code questions.
*);
end CodeGraded;
(* OPERATIONS *)
operation GradeTest
inputs: AnsweredTest*;
outputs: GradedTest*;
description: (* Autogrades a batch of AnsweredTests creating a GradedTest
out of each. This means that it will assign a score to every question
that does not require manual entry of a score (i.e. - multiple choice
and matching questions. It will also hightlight keywords in free
response questions and execute analysis with output comparison for
grading programming questions.
*);
end GradeTest;
operation AcceptGrade
inputs: gq:GradedQuestion, gs:GradedSection, gt:GradedTest;
outputs: gq':GradedQuestion, gs':GradedSection, gt':GradedTest;
postcondition: forall (gq'':GradedQuestion)
(gq'' in gs'.gq) iff ((gq'' = gq') or
((gq'' != gq) and (gq'' in gs.gq)));
description: (* Updates a GradedQuestion object with the current
score and comments.
*);
end AcceptGrade;
operation percentGrade
inputs: points:AnsweredQuestion.points, percent:integer;
outputs: score:integer;
precondition: percent >= 0;
description: (* Changes the point value awarded for an answer based
on the percent value entered by the grader.
*);
end percentGrade;
end TestGrading;
Prev: testgeneration.fmsl
| Next: testtaking.fmsl
| Up: specification
| Top: index