针对传统的编程题自动评分方法没有考虑学生程序是怎样实现编程任务的,以及不能从程序文本的语法结构和语义角度衡量学生程序与正确答案的接近程度等问题,提出一种基于程序理解的自动评分方法.以程序理解的一般过程及基本策略为依据,结合人工阅卷的思维过程,建立评分模型.评分过程可划分为3个阶段:首先将程序代码转换成系统依赖图中间表示形式;然后,对系统依赖图进行标准化转换,消除程序表达方式的多样性;最后,匹配标准化后的学生程序与模板程序系统依赖图并根据匹配结果给出评分.该方法被应用于“C语言编程题自动评分系统”中.实验结果表明:它可以根据学生程序的语法和语义衡量学生程序实现编程任务的正确程度,具有较高的准确性.
Traditional approaches of automatically grading student programs do not take into account how a student program answers a given programming task, and can not evaluate how close the source code is to correct solutions. Therefore, a new approach is proposed based on program understanding. A model is implemented based on the combining of the common process and basic strategies of program understanding with the thinking mode of manual grading. A set of typical model programs representing the correct way to implementing the programming task are provided to match with a student program. Firstly, the student Program and model programs are transformed into an intermediate representation called system dependence graph. Then, program normalization is performed on the system dependence graphs to remove code variations, so as to recognize syntactically different but semantically equivalent constructs. Finally, the normalized system dependence graph of the student program and those of model programs are matched and a mark is given. This approach has been applied to an on-line examination system for the programming language C. Test results show that it can evaluate how close a source code is to correct solutions in terms of syntax and semantics, and it has a high grading accuracy.