[go: up one dir, main page]

CN105427695B - Program class examination paper automatic assessment method and system - Google Patents

Program class examination paper automatic assessment method and system Download PDF

Info

Publication number
CN105427695B
CN105427695B CN201510740357.8A CN201510740357A CN105427695B CN 105427695 B CN105427695 B CN 105427695B CN 201510740357 A CN201510740357 A CN 201510740357A CN 105427695 B CN105427695 B CN 105427695B
Authority
CN
China
Prior art keywords
code
tested
assessed
test case
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201510740357.8A
Other languages
Chinese (zh)
Other versions
CN105427695A (en
Inventor
高万林
胡慧
郑立华
陈瑛
吕春利
冀荣华
李鑫
李静
段晶洁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Agricultural University
Original Assignee
China Agricultural University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Agricultural University filed Critical China Agricultural University
Priority to CN201510740357.8A priority Critical patent/CN105427695B/en
Publication of CN105427695A publication Critical patent/CN105427695A/en
Application granted granted Critical
Publication of CN105427695B publication Critical patent/CN105427695B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09BEDUCATIONAL OR DEMONSTRATION APPLIANCES; APPLIANCES FOR TEACHING, OR COMMUNICATING WITH, THE BLIND, DEAF OR MUTE; MODELS; PLANETARIA; GLOBES; MAPS; DIAGRAMS
    • G09B7/00Electrically-operated teaching apparatus or devices working with questions and answers
    • G09B7/02Electrically-operated teaching apparatus or devices working with questions and answers of the type wherein the student is expected to construct an answer to the question which is presented or wherein the machine gives an answer to the question presented by a student
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/362Debugging of software
    • G06F11/3624Debugging of software by performing operations on the source code, e.g. via a compiler

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Educational Administration (AREA)
  • Educational Technology (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本发明涉及一种编程类考题自动测评方法,包括:S1:服务器端获取客户端发来的待测评代码以及预设的测试用例;S2:确定所述测试用例对应的输入、输出、权重和分数;S3:根据所述测试用例的输入,运行所述待测评代码,得到所述待测评代码的输出结果;S4:将所述待测评代码的输出结果与所述测试用例的期望的输出进行匹配,并根据所述测试用例的权重和分数,计算所述待测评代码的得分。采用本发明所提供的编程类考题自动测评方法,可以根据预设的测试用例,自动地评判程序的正确性,并返回相应的分数,能够有效解决老师对学生提交的编程题作业的繁琐验证、不能有效客观给分问题,从而更好地为编程语言类课程提供服务。

The present invention relates to an automatic evaluation method for programming test questions, comprising: S1: the server obtains the code to be evaluated and the preset test case sent by the client; S2: determines the input, output, weight and score corresponding to the test case ; S3: Run the code to be evaluated according to the input of the test case to obtain the output result of the code to be evaluated; S4: Match the output result of the code to be evaluated with the expected output of the test case , and calculate the score of the code to be evaluated according to the weight and score of the test case. By adopting the automatic evaluation method for programming test questions provided by the present invention, the correctness of the program can be automatically judged according to the preset test cases, and the corresponding scores can be returned, which can effectively solve the cumbersome verification of the programming problem assignments submitted by the teacher, It cannot effectively and objectively score questions, so as to better serve programming language courses.

Description

编程类考题自动测评方法和系统Method and system for automatic evaluation of programming test questions

技术领域technical field

本发明涉及教育应用领域,尤其涉及一种编程类考题自动测评方法和系统。The invention relates to the field of educational applications, in particular to an automatic evaluation method and system for programming test questions.

背景技术Background technique

近年来,一种新的网络课程教学模式MOOC(Massive Open Online Course,大规模在线开放课程)在教育领域兴起。以edx为例,因为免费、公开引得无数青年学子竞相追捧,用户也逐渐增加,目前已经拥有超过90万的注册者。对于大规模在线教育,“大规模”意味着参与者的数量不受限制;“开放”意味着任何人都可以参与学习,而且是免费的;“在线”意味着参与者通过网络参与课程,不受地域限制。C语言、C++语言、Java语言是目前计算机程序设计中应用广泛的编程语言,在各类高等院校的计算机及相关专业中,C、C++等语言是必修的基础课。In recent years, a new network course teaching mode MOOC (Massive Open Online Course, Massive Open Online Course) has emerged in the field of education. Take edx as an example, because it is free and open, it has attracted countless young students, and its users have gradually increased. Currently, it has more than 900,000 registered users. For massive online education, "massive" means that the number of participants is unlimited; "open" means that anyone can participate in the learning, and it is free; "online" means that participants participate in the course through the network, without Geographically restricted. C language, C++ language, and Java language are widely used programming languages in computer programming at present. C, C++ and other languages are compulsory basic courses in computer and related majors in various colleges and universities.

目前,学校对于编程类考题的测评都以老师人工批改为主,评分时的人为情绪等原因造成评分的偏差,这些对于学生都是不公平的。学生在学习编程时,需要在机房或个人电脑上安装集成开发环境,编辑程序、编译程序、运行程序,而在碰到常见的编译、运行等问题时,往往难以下手解决。此外,老师在评判学生的编程题作业时,需要拷贝程序、编译程序、运行程序后才能给出分数,工作量大,且费时耗力。At present, the school's assessment of programming test questions is mainly based on manual marking by teachers. Human emotions and other reasons during grading cause deviations in grading, which is unfair to students. When students learn programming, they need to install an integrated development environment in the computer room or personal computer, edit the program, compile the program, and run the program. However, when encountering common problems such as compiling and running, it is often difficult to solve them. In addition, when judging the students' programming assignments, the teacher needs to copy the program, compile the program, and run the program before giving the score, which is a heavy workload, time-consuming and labor-intensive.

综上,设计一种编程类考题自动测评方法,来减少教师的工作量具有十分重要的作用。To sum up, it is very important to design an automatic evaluation method for programming test questions to reduce the workload of teachers.

发明内容Contents of the invention

本发明所要解决的技术问题是如何提供一种对编程类考题自动测评的方法。The technical problem to be solved by the present invention is how to provide an automatic evaluation method for programming test questions.

为此目的,本发明提出了一种编程类考题自动测评方法,包括以下步骤:To this end, the present invention proposes a method for automatic evaluation of programming class examination questions, comprising the following steps:

S1:服务器端获取客户端发来的待测评代码以及预设的测试用例;S1: The server obtains the code to be evaluated and the preset test cases sent by the client;

S2:确定所述测试用例对应的输入、输出、权重和分数;S2: Determine the input, output, weight and score corresponding to the test case;

S3:根据所述测试用例的输入,运行所述待测评代码,得到所述待测评代码的输出结果;S3: Run the code to be evaluated according to the input of the test case, and obtain an output result of the code to be evaluated;

S4:将所述待测评代码的输出结果与所述测试用例期望的所述输出进行匹配,并根据所述测试用例的权重和分数,计算所述待测评代码的得分。S4: Match the output result of the code to be evaluated with the expected output of the test case, and calculate the score of the code to be evaluated according to the weight and score of the test case.

优选地,所述步骤S1还包括:判断所述待测评代码内是否包含被禁止的系统命令,如果包含被禁止的系统命令,则停止所述待测评代码的运行。Preferably, the step S1 further includes: judging whether the code to be evaluated contains a prohibited system command, and if the code to be evaluated contains a prohibited system command, stopping the running of the code to be evaluated.

优选地,所述步骤S1还包括:编译所述待测评代码,并获取编译结果,如果编译出错则返回出错信息。Preferably, the step S1 further includes: compiling the code to be evaluated, obtaining a compiling result, and returning an error message if compiling an error.

优选地,在步骤S1之前还包括:Preferably, before step S1, it also includes:

运行所述服务器端的程序,将所述服务器端的程序的进程号写入运行文件;并开启运行程序监控线程;Run the program on the server side, write the process number of the program on the server side into the running file; and start the running program monitoring thread;

通过主线程创建Socket、绑定Socket、监听Socket端口,并等待所述客户端的连接请求;其中,接收一个客户端的连接后,新建一个线程继续处理另一个客户端的连接请求。Create a Socket through the main thread, bind the Socket, monitor the Socket port, and wait for the connection request of the client; wherein, after receiving the connection of a client, create a new thread to continue processing the connection request of another client.

优选地,所述步骤S3还包括:Preferably, said step S3 also includes:

将所述待测评代码的名称通过消息队列发送到所述服务器端的运行程序监控线程,通过所述运行程序监控线程监控所述待测评代码的运行过程。The name of the code to be evaluated is sent to the running program monitoring thread on the server side through the message queue, and the running process of the code to be evaluated is monitored through the running program monitoring thread.

优选地,所述运行程序监控线程监控所述待测评代码的运行过程具体包括以下步骤:Preferably, the running program monitoring thread monitoring the running process of the code to be evaluated specifically includes the following steps:

S301:打开所述消息队列;S301: Open the message queue;

S302:等待接收所述消息队列;S302: Waiting to receive the message queue;

S303:休眠第一预设时间;S303: sleep for a first preset time;

S304:判断所述待测评代码是否仍在运行;如果已经停止运行,则继续进入步骤S302;如果仍在运行,则继续休眠第二预设时间;S304: Determine whether the code to be evaluated is still running; if it has stopped running, proceed to step S302; if it is still running, continue to sleep for a second preset time;

S305:在休眠第二预设之间之后,如果所述待测评代码仍在运行,则强制终止所述待测评代码的运行;如果已经停止运行,则继续进入步骤S302。S305: After the second preset period of dormancy, if the code to be evaluated is still running, forcibly terminate the running of the code to be evaluated; if it has stopped running, continue to step S302.

再一方面,本发明还提供了一种编程类考题自动测评系统,包括服务器端和客户端,所述服务器端包括接收单元、解析单元、运行单元和比较单元;In yet another aspect, the present invention also provides an automatic evaluation system for programming test questions, including a server end and a client end, and the server end includes a receiving unit, an analyzing unit, an operating unit, and a comparing unit;

所述接收单元用于获取客户端发来的待测评代码以及预设的测试用例;The receiving unit is used to obtain the code to be evaluated and the preset test case sent by the client;

所述解析单元用于确定所述测试用例对应的输入、输出、权重和分数;The parsing unit is used to determine the input, output, weight and score corresponding to the test case;

所述运行单元用于根据所述测试用例的输入,运行所述待测评代码,得到所述待测评代码的输出结果;The running unit is used to run the code to be evaluated according to the input of the test case, and obtain an output result of the code to be evaluated;

所述比较单元用于将所述待测评代码的输出结果与所述测试用例期望的所述输出进行匹配,并根据所述测试用例的权重和分数,计算所述待测评代码的得分。The comparison unit is configured to match the output of the code to be evaluated with the expected output of the test case, and calculate the score of the code to be evaluated according to the weight and score of the test case.

优选地,所述客户端包括出题模块、答题模块;Preferably, the client includes a question-making module and a question-answering module;

所述出题模块用于向所述服务器端提交编程试题以及所述预设的测试用例;The question making module is used to submit programming test questions and the preset test cases to the server;

所述答题模块用于向所述服务器端提交所述待测评代码。The answering module is used to submit the code to be evaluated to the server.

优选地,所述客户端还包括防抄袭模块,所述防抄袭模块用于计算任意两份所述待测评代码的相似度。Preferably, the client further includes an anti-plagiarism module, and the anti-plagiarism module is used to calculate the similarity between any two codes to be evaluated.

优选地,所述服务器端是分布式集群系统,包括评测管理节点、程序运行节点、作业管理节点、任务节点、数据管理节点和数据节点;所述数据管理节点和数据节点构成分布式文件系统,为其他各个节点处理数据提供保存程序代码以及其他数据的环境;Preferably, the server end is a distributed cluster system, including evaluation management nodes, program running nodes, job management nodes, task nodes, data management nodes and data nodes; the data management nodes and data nodes constitute a distributed file system, Provide an environment for storing program codes and other data for other nodes to process data;

所述评测管理节点用于在收到客户端的连接请求后,通过数据管理节点将待测评代码保存到所述分布式文件系统中,并根据当前的负载情况给所述待测评代码分配所述程序运行节点;The evaluation management node is used to store the code to be evaluated in the distributed file system through the data management node after receiving the connection request from the client, and assign the program to the code to be evaluated according to the current load condition run node;

所述程序运行节点用于编译、运行所述待测评代码,并将编译、运行的输出结果保存在所述分布式文件系统中;The program running node is used for compiling and running the code to be evaluated, and saving the output results of compiling and running in the distributed file system;

所述作业管理节点用于提交搜索查询代码作业,并分配作业到各个所述任务节点,通过各个所述任务节点并发进行代码的大数据搜索、匹配,并将匹配结果返回到所述作业管理节点;The job management node is used to submit the search query code job, and assign the job to each of the task nodes, and perform the big data search and matching of the code concurrently through each of the task nodes, and return the matching result to the job management node ;

所述评测管理节点还用于将所述运行输出的结果以及匹配结果返回到所述客户端。The evaluation management node is further configured to return the running output result and the matching result to the client.

通过采用本发明所提供的编程类考题自动测评方法和系统,可以为在线教育平台学习计算机程序设计课程,比如C程序设计、C++程序设计课程提供在线编辑程序、编译程序、运行程序的分布式集群测试环境;可以根据老师设置的程序用例,实时地、自动地评判程序的正确性,并返回相应的分数;还可以对提交的程序代码进行大数据分析,分析学生代码的相似率,达到防抄袭的目的,能够有效解决老师对学生提交编程题作业的繁琐验证、不能有效客观给分、不能给出编译运行出错的帮助信息、不能给出程序参考代码等问题,从而更好地为编程语言类课程提供服务。By adopting the automatic evaluation method and system for programming class examination questions provided by the present invention, it is possible to learn computer programming courses for online education platforms, such as C programming and C++ programming courses that provide online editing programs, compiling programs, and distributed clusters of running programs Test environment; according to the program use cases set by the teacher, the correctness of the program can be judged in real time and automatically, and the corresponding score can be returned; it can also conduct big data analysis on the submitted program code, analyze the similarity rate of student code, and prevent plagiarism The purpose is to effectively solve the problems of teachers’ cumbersome verification of students’ submission of programming assignments, the inability to effectively and objectively give marks, the inability to give help information for compilation and operation errors, and the inability to give program reference codes, etc., so as to better serve programming language classes. Courses provide services.

附图说明Description of drawings

通过参考附图会更加清楚的理解本发明的特征和优点,附图是示意性的而不应理解为对本发明进行任何限制,在附图中:The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the invention in any way. In the accompanying drawings:

图1示出了本发明编程类考题自动测评方法的流程示意图;Fig. 1 shows the schematic flow chart of the automatic evaluation method for programming class examination questions of the present invention;

图2示出了本发明服务器端分布式集群系统的示意图;Fig. 2 shows a schematic diagram of the server-side distributed cluster system of the present invention;

图3示出了本发明运行程序监控线程监控待测评代码的运行过程示意图。Fig. 3 shows a schematic diagram of the running process of the running program monitoring thread monitoring the code to be evaluated in the present invention.

具体实施方式Detailed ways

下面将结合附图对本发明的实施例进行详细描述。Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

实施例1Example 1

如图1所示,本发明提供了一种编程类考题自动测评方法,包括以下步骤:As shown in Figure 1, the present invention provides a method for automatic evaluation of programming class examination questions, comprising the following steps:

运行服务器端的程序,将服务器端的程序的进程号写入运行文件;并开启运行程序监控线程;Run the program on the server side, write the process number of the program on the server side into the running file; and start the running program monitoring thread;

通过主线程创建Socket、绑定Socket、监听Socket端口,并等待客户端的连接请求;其中,接收一个客户端的连接后,新建一个线程继续处理另一个客户端的连接请求。Create a Socket through the main thread, bind the Socket, monitor the Socket port, and wait for the client's connection request; wherein, after receiving a client's connection, create a new thread to continue processing another client's connection request.

S1:服务器端获取客户端发来的待测评代码以及预设的测试用例;判断所述待测评代码内是否包含被禁止的系统命令。例如,通过解析json字符串,识别是否包含fdisk(硬盘分区)、shutdown(关机)等被禁止的系统命令,如果包含被禁止的系统命令,则停止所述待测评代码的运行。根据method方法,选择编译器、编译选项,编译所述待测评代码,并获取编译结果,如果编译出错则返回出错信息。S1: The server acquires the code to be evaluated and the preset test cases sent by the client; and judges whether the code to be evaluated contains prohibited system commands. For example, by parsing the json character string, it is identified whether prohibited system commands such as fdisk (hard disk partition) and shutdown (shutdown) are included, and if the prohibited system commands are included, the operation of the code to be evaluated is stopped. According to the method, select the compiler and compilation options, compile the code to be evaluated, and obtain the compilation result, and return an error message if the compilation fails.

S2:确定所述测试用例对应的输入、输出、权重和分数;其中,测试用例可以设置多组,每组测试用例有不同的输入,期望的输出;每组测试用例,可以设置不同的权重,从而得到不同的分值。也就说,即使代码程序通过投机取巧的方式,也只能通过一组测试用例,不可能通过所有或部分测试用例。S2: Determine the input, output, weight and score corresponding to the test case; wherein, multiple groups of test cases can be set, and each group of test cases has different inputs and expected outputs; each group of test cases can be set with different weights, resulting in different scores. In other words, even if the code program is opportunistic, it can only pass a set of test cases, and it is impossible to pass all or part of the test cases.

S3:根据所述测试用例的输入,运行所述待测评代码,得到所述待测评代码的输出结果;为了加强系统程序的健壮性、稳定性、安全性,需要监控评测服务的运行,一旦评测服务程序由于某种原因宕掉或被恶意搞破坏,系统能够自动恢复启动。所以在运行测评代码程序之前,将所述待测评代码的名称通过IPC消息队列发送到所述服务器端的运行程序监控线程,通过所述运行程序监控线程监控所述待测评代码的运行过程。对客户端提交的代码需要有一个运行程序监控线程监控这些代码的运行,包括:对程序代码进行病毒、恶意代码扫描检查;对程序代码执行的系统命令或调用特殊的系统API(应用程序编程接口)进行扫描检查;对程序代码内存分配、释放、检查,程序运行结束系统应自动释放回收用户程序未显示释放的内存;对程序代码中有问题或有设计缺陷,比如程序死循环,运行程序一直阻塞、空耗CPU资源等进行检查,一旦检测到某个运行程序异常,则立刻终止该程序的运行。此外,不允许程序使用sleep休眠函数,如果某个程序运行时间超过1000毫秒,我们则认为该程序进入死循环,系统后台将强制终止该程序的运行,从而保障评测系统的安全性。S3: According to the input of the test case, run the code to be evaluated to obtain the output of the code to be evaluated; in order to strengthen the robustness, stability, and security of the system program, it is necessary to monitor the operation of the evaluation service. If the service program crashes or is maliciously damaged for some reason, the system can automatically resume and start. Therefore, before running the evaluation code program, the name of the code to be evaluated is sent to the running program monitoring thread of the server through the IPC message queue, and the running process of the code to be evaluated is monitored through the running program monitoring thread. The code submitted by the client needs to have a running program monitoring thread to monitor the operation of these codes, including: performing virus and malicious code scanning checks on the program code; ) to scan and check; allocate, release, and check program code memory, and the system should automatically release and recycle the memory that the user program has not released after the program runs; if there are problems or design defects in the program code, such as program infinite loop, the running program will continue to run Blocking, empty CPU resource consumption, etc. are checked. Once an abnormal running program is detected, the running of the program will be terminated immediately. In addition, programs are not allowed to use the sleep function. If a program runs for more than 1000 milliseconds, we consider the program to enter an infinite loop, and the system background will forcibly terminate the program to ensure the safety of the evaluation system.

如图3所示,所述运行程序监控线程监控所述待测评代码的运行过程具体包括以下步骤:As shown in Figure 3, the running process of the running program monitoring thread monitoring the code to be evaluated specifically includes the following steps:

S301:打开所述消息队列;S301: Open the message queue;

S302:等待接收所述消息队列;S302: Waiting to receive the message queue;

S303:休眠第一预设时间;S303: sleep for a first preset time;

S304:判断所述待测评代码是否仍在运行;如果已经停止运行,则继续进入步骤S302;如果仍在运行,则继续休眠第二预设时间;S304: Determine whether the code to be evaluated is still running; if it has stopped running, proceed to step S302; if it is still running, continue to sleep for a second preset time;

S305:在休眠第二预设之间之后,如果所述待测评代码仍在运行,则强制终止所述待测评代码的运行;如果已经停止运行,则继续进入步骤S302。其中,第一预设时间可以为300ms(毫秒),第二预设时间可以为1s(秒)。S305: After the second preset period of dormancy, if the code to be evaluated is still running, forcibly terminate the running of the code to be evaluated; if it has stopped running, continue to step S302. Wherein, the first preset time may be 300ms (millisecond), and the second preset time may be 1s (second).

S4:将所述待测评代码的输出结果与所述测试用例期望的输出进行匹配,并根据所述测试用例的权重和分数,计算所述待测评代码的得分。S4: Match the output result of the code to be evaluated with the expected output of the test case, and calculate the score of the code to be evaluated according to the weight and score of the test case.

实施例2Example 2

采用实施例1所述的编程类考题自动测评方法,本发明还提供了一种编程类考题自动测评系统,包括服务器端和客户端,所述服务器端包括接收单元、解析单元、运行单元和比较单元;By adopting the automatic evaluation method for programming type examination questions described in Embodiment 1, the present invention also provides an automatic evaluation system for programming type examination questions, including a server end and a client end, and the server end includes a receiving unit, an analysis unit, an operating unit and a comparison unit;

所述接收单元用于获取客户端发来的待测评代码以及预设的测试用例;The receiving unit is used to obtain the code to be evaluated and the preset test case sent by the client;

所述解析单元用于确定所述测试用例对应的输入、输出、权重和分数;The parsing unit is used to determine the input, output, weight and score corresponding to the test case;

所述运行单元用于根据所述测试用例的输入,运行所述待测评代码,并得到所述待测评代码的输出结果;The running unit is used to run the code to be evaluated according to the input of the test case, and obtain an output result of the code to be evaluated;

所述比较单元用于将所述待测评代码的输出结果与所述测试用例期望的输出进行匹配,并根据所述测试用例的权重和分数,计算所述待测评代码的得分。The comparison unit is used to match the output result of the code to be evaluated with the expected output of the test case, and calculate the score of the code to be evaluated according to the weight and score of the test case.

其中较优的,所述客户端可以包括出题模块、答题模块;所述出题模块用于向所述服务器端提交编程试题以及所述预设的测试用例;所述答题模块用于向所述服务器端提交所述待测评代码。所述客户端还包括防抄袭模块,所述防抄袭模块用于计算任意两份所述待测评代码的相似度。Preferably, the client may include a questioning module and an answering module; the questioning module is used to submit programming questions and the preset test cases to the server; the answering module is used to submit The server end submits the code to be evaluated. The client also includes an anti-plagiarism module, and the anti-plagiarism module is used to calculate the similarity between any two copies of the codes to be evaluated.

如图2所示,该服务器端是分布式集群系统,包括评测管理节点、程序运行节点、作业管理节点、任务节点、数据管理节点和数据节点;所述数据管理节点和数据节点构成分布式文件系统,为其他各个节点处理数据提供保存程序代码以及其他数据的环境;As shown in Figure 2, the server side is a distributed cluster system, including evaluation management nodes, program running nodes, job management nodes, task nodes, data management nodes and data nodes; the data management nodes and data nodes constitute a distributed file The system provides an environment for storing program codes and other data for other nodes to process data;

所述评测管理节点用于在收到客户端的连接请求后,通过数据管理节点将待测评代码保存到所述分布式文件系统中,并根据当前的负载情况给所述待测评代码分配所述程序运行节点;The evaluation management node is used to store the code to be evaluated in the distributed file system through the data management node after receiving the connection request from the client, and assign the program to the code to be evaluated according to the current load condition run node;

所述程序运行节点用于编译、运行所述待测评代码,并将编译、运行的输出结果保存在所述分布式文件系统中;The program running node is used for compiling and running the code to be evaluated, and saving the output results of compiling and running in the distributed file system;

所述作业管理节点用于提交搜索查询代码作业,并分配作业到各个所述任务节点,通过各个所述任务节点并发进行代码的大数据搜索、匹配,并将匹配结果返回到所述作业管理节点;The job management node is used to submit the search query code job, and assign the job to each of the task nodes, and perform the big data search and matching of the code concurrently through each of the task nodes, and return the matching result to the job management node ;

所述评测管理节点还用于将所述运行输出的结果以及匹配结果返回到所述客户端。The evaluation management node is further configured to return the running output result and the matching result to the client.

具体的,在出题模块,教师可以添加编程题,设置编程题类型、分数,起止时间等,填写编程题目,问题描述,测试用例,点击提交,即可生成一道编程题。其中,测试用例可以设置多组,每组测试用例有不同的输入,期望的输出;每组测试用例,可以设置不同的权重,从而得到不同的分值。而在答题模块,学生可以在“编辑代码”区域内进行待测评代码的编辑,如果代码有需要输入值,还可以填写相应的输入值,可以点击“运行”按钮对代码进行编译,如果代码有问题,则会显示编译报错;如果编译未通过,“编译结果”输出框会给出相应的编译出错信息提示。如果代码运行正常,只显示运行结果,并不显示编译结果。当学生点击“提交”按钮,即将代码上传到服务器端,然后交给服务器端进行自动评测,根据教师预先设置的测试用例的输入和输出,与学生提交的待测评代码进行模糊匹配,如果源代码经过了之前设置的多组测试用例,即可获得满分,如果有一组测试用例没通过,即会根据相应的比重计算分数。Specifically, in the question making module, teachers can add programming questions, set programming question types, scores, start and end times, etc., fill in programming questions, problem descriptions, test cases, and click submit to generate a programming question. Among them, multiple groups of test cases can be set, and each group of test cases has different inputs and expected outputs; each group of test cases can be set with different weights to obtain different scores. In the answering module, students can edit the code to be evaluated in the "Edit Code" area. If the code needs to input values, they can also fill in the corresponding input values. They can click the "Run" button to compile the code. If there is a problem, a compilation error will be displayed; if the compilation fails, the "compilation result" output box will give a corresponding compilation error message prompt. If the code runs normally, only the running result is displayed, and the compilation result is not displayed. When the student clicks the "Submit" button, the code will be uploaded to the server, and then handed over to the server for automatic evaluation. According to the input and output of the test case preset by the teacher, it will be fuzzy matched with the code to be evaluated submitted by the student. If the source code After passing multiple sets of test cases set before, you can get a full score. If a set of test cases fails, the score will be calculated according to the corresponding proportion.

防抄袭模块,主要是便于教师查看学生之间编程题作业的雷同情况。对任意两学生A和B同一道编程题的作业进行相似度计算,将A同学待检测作业的每一行代码与B同学作业的每一行代码计算相似度(字数少于15字的代码行不进行计算),最高值作为两人作业该行代码的相似度,计算所有行代码相似度的平均值作为两同学该道编程题作业的相似度。The anti-plagiarism module is mainly for teachers to check the similarity of programming assignments among students. Calculate the similarity of any two students A and B's homework of the same programming problem, and calculate the similarity between each line of code of student A's homework to be tested and each line of code of student B's homework (code lines with less than 15 words will not be performed) Calculation), the highest value is taken as the similarity of the line of code of two people's homework, and the average of the similarity of all lines of code is calculated as the similarity of the two students' homework of this programming problem.

通过采用本发明所提供的编程类考题自动测评方法和系统,可以为在线教育平台学习计算机程序设计课程,比如C程序设计、C++程序设计课程提供在线编辑程序、编译程序、运行程序的分布式集群测试环境;可以根据老师设置的程序用例,实时地、自动地评判程序的正确性,并返回相应的分数;还可以对提交的程序代码进行大数据分析,分析学生代码的相似率,达到防抄袭的目的,能够有效解决老师对学生提交编程题作业的繁琐验证、不能有效客观给分、不能给出编译运行出错的帮助信息、不能给出程序参考代码等问题,从而更好地为编程语言类课程提供服务。By adopting the automatic evaluation method and system for programming class examination questions provided by the present invention, it is possible to learn computer programming courses for online education platforms, such as C programming and C++ programming courses that provide online editing programs, compiling programs, and distributed clusters of running programs Test environment; according to the program use cases set by the teacher, the correctness of the program can be judged in real time and automatically, and the corresponding score can be returned; it can also conduct big data analysis on the submitted program code, analyze the similarity rate of student code, and prevent plagiarism The purpose is to effectively solve the problems of teachers’ cumbersome verification of students’ submission of programming assignments, the inability to effectively and objectively give marks, the inability to give help information for compilation and operation errors, and the inability to give program reference codes, etc., so as to better serve programming language classes. Courses provide services.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本发明可以通过硬件实现,也可以借助软件和必要的通用硬件平台的方式来实现。基于这样的理解,本发明的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the above description of the implementation manners, those skilled in the art can clearly understand that the present invention can be implemented by hardware, or by means of software and a necessary general-purpose hardware platform. Based on this understanding, the technical solution of the present invention can be embodied in the form of software products, which can be stored in a non-volatile storage medium (which can be CD-ROM, U disk, mobile hard disk, etc.), including several The instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute the methods described in various embodiments of the present invention.

虽然结合附图描述了本发明的实施方式,但是本领域技术人员可以在不脱离本发明的精神和范围的情况下做出各种修改和变型,这样的修改和变型均落入由所附权利要求所限定的范围之内。Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention. within the bounds of the requirements.

Claims (8)

1. a kind of programming class examination paper automatic assessment method, which is characterized in that include the following steps:
S1:Server end obtains the code to be tested and assessed and preset test case that client is sent;
S2:Determine the corresponding input of the test case, output, weight and score;
S3:According to the input of the test case, code to be tested and assessed described in operation obtains the output knot of the code to be tested and assessed Fruit;
S4:The output result of the code to be tested and assessed is matched with the desired output of the test case, and according to The weight and score of the test case, the score of code to be tested and assessed described in calculating;
Wherein, the step S3 further includes:
The title of the code to be tested and assessed is sent to the operation program monitoring thread of the server end by message queue, is led to Cross the operational process of code to be tested and assessed described in the operation program monitoring thread monitoring;
Wherein, the operational process of code to be tested and assessed described in the operation program monitoring thread monitoring specifically includes following steps:
S301:Open the message queue;
S302:Etc. the message queue to be received;
S303:The first preset time of suspend mode;
S304:Whether code to be tested and assessed described in judgement is still running;If out of service, step S302 is gone successively to; If still run, continue the second preset time of suspend mode;
S305:It is to be measured described in forced termination if the code to be tested and assessed still is being run after between suspend mode second is default Comment the operation of code;If out of service, step S302 is gone successively to.
2. a kind of programming class examination paper automatic assessment method according to claim 1, which is characterized in that the step S1 is also wrapped It includes:Whether include forbidden system command in code to be tested and assessed described in judgement, if including forbidden system command, stops The only operation of the code to be tested and assessed.
3. a kind of programming class examination paper automatic assessment method according to claim 1 or 2, which is characterized in that the step S1 Further include:Code to be tested and assessed described in compiling, and compiling is obtained as a result, returning to error message if compiling and malfunctioning.
4. a kind of programming class examination paper automatic assessment method according to claim 1 or 2, which is characterized in that step S1 it Before further include:
Operating file is written in the process number of the program of the server end by the program for running the server end;And open fortune Line program monitoring thread;
Socket is created by main thread, binding Socket, monitors the ports Socket, and the connection of the client is waited for ask It asks;Wherein, after the connection for receiving a client, the connection request that a thread continues with another client is created.
5. a kind of automatic evaluation system of programming class examination paper, which is characterized in that including server end and client, the server end Including receiving unit, resolution unit, running unit and comparing unit;
The receiving unit is for obtaining the code to be tested and assessed and preset test case that client is sent;
The resolution unit is for determining the corresponding input of the test case, output, weight and score;
The running unit is used for according to the input of the test case, code test and assess described in operation, obtain described in wait testing and assessing The output result of code;
The comparing unit be used for by the output result of code test and assess and the test case it is desired it is described export into Row matching, and according to the weight and score of the test case, the score of code to be tested and assessed described in calculating;
Wherein, the running unit is additionally operable to:
The title of the code to be tested and assessed is sent to the operation program monitoring thread of the server end by message queue, is led to Cross the operational process of code to be tested and assessed described in the operation program monitoring thread monitoring;
Wherein, the operational process of code to be tested and assessed described in the operation program monitoring thread monitoring specifically includes following steps:
S301:Open the message queue;
S302:Etc. the message queue to be received;
S303:The first preset time of suspend mode;
S304:Whether code to be tested and assessed described in judgement is still running;If out of service, step S302 is gone successively to; If still run, continue the second preset time of suspend mode;
S305:It is to be measured described in forced termination if the code to be tested and assessed still is being run after between suspend mode second is default Comment the operation of code;If out of service, step S302 is gone successively to.
6. the automatic evaluation system of programming class examination paper according to claim 5, which is characterized in that the client includes setting a question Module, answer module;
The module of setting a question to the server end for submitting programming examination question and the preset test case;
The answer module is used for code to be tested and assessed described in server end submission.
7. the automatic evaluation system of programming class examination paper according to claim 6, which is characterized in that the client further includes preventing Plagiarize module, the anti-similarity plagiarized module and be used to calculate code to be tested and assessed described in arbitrary two parts.
8. the automatic evaluation system of programming class examination paper according to claim 5 or 6, which is characterized in that
The server end is distributed cluster system, including evaluation and test management node, program operation node, job management node, Task node, data management node and back end;The data management node and back end constitute distributed file system, Save routine code and the environment of other data are provided for other each node processing data;
The evaluation and test management node is used for after receiving the connection request of client, will code be tested and assessed by data management node It is saved in the distributed file system, and according to current loading condition to the code distribution described program fortune to be tested and assessed Row node;
Described program operation node for compile, run described in code test and assess, and will compile, run output result be stored in In the distributed file system;
The job management node distributes operation to each task node for submitting search inquiry code operation, leads to It crosses each task node and concurrently returns to the working pipe into the search of the big data of line code, matching, and by matching result Manage node;
The evaluation and test management node is additionally operable to the output result and matching result of the operation returning to the client.
CN201510740357.8A 2015-11-03 2015-11-03 Program class examination paper automatic assessment method and system Expired - Fee Related CN105427695B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510740357.8A CN105427695B (en) 2015-11-03 2015-11-03 Program class examination paper automatic assessment method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510740357.8A CN105427695B (en) 2015-11-03 2015-11-03 Program class examination paper automatic assessment method and system

Publications (2)

Publication Number Publication Date
CN105427695A CN105427695A (en) 2016-03-23
CN105427695B true CN105427695B (en) 2018-11-02

Family

ID=55505868

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510740357.8A Expired - Fee Related CN105427695B (en) 2015-11-03 2015-11-03 Program class examination paper automatic assessment method and system

Country Status (1)

Country Link
CN (1) CN105427695B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106326112B (en) * 2016-08-15 2019-02-15 江苏海事职业技术学院 Method and device for automatic correction of program operation
CN107678954A (en) * 2017-09-22 2018-02-09 江苏海事职业技术学院 A kind of procedure operation evaluating method and device
CN109144496A (en) * 2018-08-23 2019-01-04 广州慧通编程教育科技有限公司 The generation method and generating means for program of testing and assessing
CN109243249B (en) * 2018-08-23 2021-07-06 广州慧通编程教育科技有限公司 Method and device for generating evaluation program
CN110633072B (en) * 2019-07-30 2023-01-20 广东工业大学 Programming training question construction method and device for automatic correction
CN110427325A (en) * 2019-07-31 2019-11-08 中国联合网络通信集团有限公司 Online testing method and device
CN111459841A (en) * 2020-04-30 2020-07-28 成都海纳智博科技有限公司 Automatic evaluation method and system for general program language
CN112035371B (en) * 2020-09-04 2022-10-04 江苏海事职业技术学院 Automatic scoring method for web application operation
WO2022051974A1 (en) * 2020-09-10 2022-03-17 深圳市大疆创新科技有限公司 Code inspection method and apparatus applied to embedded platform, device and computer-readable storage medium
CN112799675A (en) * 2021-01-22 2021-05-14 中森云链(成都)科技有限责任公司 Automatic evaluation method for drawing programming examination questions
CN114489664B (en) * 2021-12-24 2024-12-10 深圳技术大学 Question judging method and system
CN117215901B (en) * 2023-11-09 2024-03-08 华南师范大学 Programming practice evaluation methods, systems, equipment and media based on dynamic tracking

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1503951A (en) * 2001-01-09 2004-06-09 托普科德公司 System and method for coding contests
CN101014002A (en) * 2006-12-12 2007-08-08 华为技术有限公司 Cluster message transmitting method and distributed cluster system
CN101398758A (en) * 2008-10-30 2009-04-01 北京航空航天大学 Detection method of code copy
CN101464922A (en) * 2009-01-22 2009-06-24 中国人民解放军国防科学技术大学 Computer architecture scheme parallel simulation optimization method based on cluster system
CN101702276A (en) * 2009-11-17 2010-05-05 吉林大学 Method for automatically evaluating the source code of computer programs centered on massive data processing
CN101719087A (en) * 2009-11-26 2010-06-02 中国科学院计算技术研究所 Microprocessor reliability evaluating method and system thereof
CN102480560A (en) * 2010-11-26 2012-05-30 上海晨兴希姆通电子科技有限公司 PND (portable navigation device), mobile terminal, information synchronization system and information synchronization method
CN104111888A (en) * 2014-07-03 2014-10-22 曹建楠 Code evaluation method, device and system for teaching
CN104239050A (en) * 2014-09-10 2014-12-24 中国科学技术大学 Method and system for ranking users in online program evaluation system
CN104239219A (en) * 2014-10-21 2014-12-24 中国科学院软件研究所 Software defect positioning technology on-line evaluating and experimenting platform and method based on coverage
CN104850411A (en) * 2015-06-10 2015-08-19 清华大学 Storage system reference evaluation program generating method and apparatus

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1235142C (en) * 2002-08-20 2006-01-04 华为技术有限公司 Embedded sorftware task endless loop monitoring method
CN100543686C (en) * 2007-11-15 2009-09-23 上海华为技术有限公司 Method and system for detecting task infinite loop
CN101504615A (en) * 2009-03-24 2009-08-12 杭州华三通信技术有限公司 Method and apparatus for providing positioning information for task endless loop
US8589898B2 (en) * 2010-03-29 2013-11-19 GM Global Technology Operations LLC Method and apparatus for analyzing software including a calibrated value
CN101853191B (en) * 2010-06-23 2013-02-20 迈普通信技术股份有限公司 Method for detecting task endless loop in operating system and operating system
CN102495793B (en) * 2011-11-11 2014-11-05 迈普通信技术股份有限公司 Method for detecting endless loop task
CN103164332B (en) * 2011-12-15 2015-11-18 迈普通信技术股份有限公司 The detection of endless loop task and disposal route

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1503951A (en) * 2001-01-09 2004-06-09 托普科德公司 System and method for coding contests
CN101014002A (en) * 2006-12-12 2007-08-08 华为技术有限公司 Cluster message transmitting method and distributed cluster system
CN101398758A (en) * 2008-10-30 2009-04-01 北京航空航天大学 Detection method of code copy
CN101464922A (en) * 2009-01-22 2009-06-24 中国人民解放军国防科学技术大学 Computer architecture scheme parallel simulation optimization method based on cluster system
CN101702276A (en) * 2009-11-17 2010-05-05 吉林大学 Method for automatically evaluating the source code of computer programs centered on massive data processing
CN101719087A (en) * 2009-11-26 2010-06-02 中国科学院计算技术研究所 Microprocessor reliability evaluating method and system thereof
CN102480560A (en) * 2010-11-26 2012-05-30 上海晨兴希姆通电子科技有限公司 PND (portable navigation device), mobile terminal, information synchronization system and information synchronization method
CN104111888A (en) * 2014-07-03 2014-10-22 曹建楠 Code evaluation method, device and system for teaching
CN104239050A (en) * 2014-09-10 2014-12-24 中国科学技术大学 Method and system for ranking users in online program evaluation system
CN104239219A (en) * 2014-10-21 2014-12-24 中国科学院软件研究所 Software defect positioning technology on-line evaluating and experimenting platform and method based on coverage
CN104850411A (en) * 2015-06-10 2015-08-19 清华大学 Storage system reference evaluation program generating method and apparatus

Also Published As

Publication number Publication date
CN105427695A (en) 2016-03-23

Similar Documents

Publication Publication Date Title
CN105427695B (en) Program class examination paper automatic assessment method and system
KR102737026B1 (en) Automatically generating machine learning models for software tools that operate on source code
Queirós et al. PETCHA: a programming exercises teaching assistant
CN105761563B (en) Student client, teacher's client and the server end of evaluating system are inscribed in programming
CN107977308A (en) interface test method and device
US11650903B2 (en) Computer programming assessment
US9446314B2 (en) Vector-based gaming content management
CN111026664B (en) ANN-based program detection method, detection system and application
Gramoli et al. Mining autograding data in computer science education
Király et al. Some aspects of grading Java code submissions in MOOCs
Dakkak et al. Webgpu: A scalable online development platform for gpu programming courses
Insa et al. Semiautomatic generation and assessment of Java exercises in engineering education
Madeyski On the effects of pair programming on thoroughness and fault-finding effectiveness of unit tests
Cammaerts et al. Investigating the effectiveness of model-based testing on testing skill acquisition
CN112380800A (en) Automatic evaluation online FPGA (field programmable Gate array) experiment platform and related method
Bondi et al. Early progress on enhancing existing software engineering courses to cultivate performance awareness
Thomas et al. ProtoTask, new task model simulator
Muhamad et al. Software Architecture of E-assessment on Higher Education
Vizulis et al. Self-testing approach and testing tools
Al-Saadi Enhancing API reliability in Kalibro. io
Corsi Ferrao et al. Investigating the Impact of Automated Code Quality Feedback in an Embedded Systems Course
Zhang et al. FLOD: Full-Lifecycle Online Judge For Accompanying Programming Teaching
Tröbs et al. JPTest-grading data science exercises in Jupyter made short, fast and scalable
KR20240158651A (en) Artificial intelligence collaboration-based task performance device
Mbogo et al. Evaluating the effect of using scaffolding techniques to support Java programming on a mobile phone

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20181102

Termination date: 20191103

CF01 Termination of patent right due to non-payment of annual fee