Question judging method and system
By building key syntax and call trees, detecting whether student code is programmed according to specified knowledge points, the problem that existing systems cannot evaluate code syntax, and improving the effectiveness of code detection and evaluation accuracy.
Patent Information
- Application Number
- CN202111608429.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2041-12-24
AI Technical Summary
The existing online question-based system cannot detect whether the student code is truly implemented according to the programming grammar required by the experiment or the test questions, which affects the effectiveness of the experiment.
By building the key syntax, using regular expressions to match key elements in the code, and determining whether the key syntax is effectively called through call tree construction, outputting the result of the question.
The grammatical evaluation of the code is realized, ensuring that students program according to the specified knowledge points when programming, and improving the effectiveness of code detection and the accuracy of evaluation.
Smart Images

Figure CN114489664B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a question determination method and system. Background Art
[0002] With the continuous advancement of educational informatization, the teaching and evaluation models have undergone tremendous changes. More and more automated processing tools are applied to various aspects of education, teaching, evaluation and assessment. Among them, the automatic evaluation system has gained favor with its advantages of high efficiency, convenience, saving manpower and material resources, and is widely used in the detection of student learning outcomes.
[0003] Existing online grading systems usually only judge the correctness of the compilation and implementation of the source code submitted by students, but cannot detect whether the student code is actually implemented according to the programming syntax required by the experiment or test questions, which affects the effectiveness of the experiment and causes students to be unable to master the relevant syntax. Summary of the invention
[0004] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art, and to provide a method and system for judging a question, which can accurately evaluate the quality of the code.
[0005] The technical solution of the present invention includes a question determination method, which includes: constructing a key grammar, wherein the key grammar includes at least one key element; reading a code and identifying whether the code contains the key grammar; determining whether all key elements in the key grammar contained in the code are effectively called; and outputting a question determination result based on whether the key elements are effectively called or the running status of the code.
[0006] According to the question-judgment method based on key programming grammar detection, the specific method of constructing key grammar includes: acquiring common keywords or key words according to the type of programming language to construct a keyword library; selecting at least one of the keywords or the key words from the keyword library as key elements to construct key grammar.
[0007] According to the judgment method, the identifying whether the code contains the key syntax includes: obtaining a regular expression based on the key syntax, the regular expression is used to match specific key elements; searching the key elements according to the regular expression to confirm whether the code contains all the key elements of the key syntax.
[0008] According to the judgment method, judging whether the key element in the code is effectively called includes: determining a first variable or a first function associated with the key element, mapping the calling path of the first variable or the first function with the help of a tree, and obtaining a calling tree of the first variable or the first function, then the key element in the code is effectively called.
[0009] According to the judgment method, the method for obtaining the first variable call tree includes: setting the first variable as the root node; if the root node is called by the second variable or the second function, setting the second variable or the second function as the first child node of the root node, then the root node and the first child node constitute the call tree; when the first child node does not exist, the first variable printed out or the first variable updated is the second child node of the root node, and the root node and the second child node constitute the call tree.
[0010] According to the judgment method, the method for obtaining the call tree of the first function includes: setting the first function as a root node; if the root node is called by a second variable or a second function, setting the second variable or the second function as the first child node of the root node, then the root node and the first child node constitute the call tree; if the first child node does not exist, the variable printed out or the updated global variable in the first function is the second child node of the root node, and the root node and the second child node constitute the call tree.
[0011] According to the judgment method, the method for obtaining the call tree of the first variable or the first function also includes: if the root node does not have a child node, the root node is a useless node, the single branch tree corresponding to the root node is deleted, and the call tree is updated.
[0012] According to the question judging method, the output question judging result includes: if all the key elements in the key grammar contained in the code are effectively called, and the result output by the code running is consistent with the answer, then the question judging result is excellent, otherwise the question judging result is poor.
[0013] The technical solution of the present invention also includes a question judgment system for implementing any of the above methods, including: a first module for constructing a key grammar, wherein the key grammar includes at least one keyword; a second module for reading a code and identifying whether the code contains the key grammar; a third module for determining whether the key grammar in the code is effectively called; and a fourth module for outputting a question judgment result based on whether the key grammar is effectively called or the running status of the code.
[0014] According to the question judging system, the third module includes:
[0015] The call tree construction submodule is used to determine the first variable or the first function associated with the keyword, and map the call path of the first variable or the first function by means of a tree to obtain the call tree of the first variable or the first function.
[0016] The beneficial effects of the present invention are: adding a key programming syntax detection function, searching the code through regular expressions, being able to detect whether the code is programmed according to the specified knowledge points, and constructing a call tree of variables or functions associated with the key syntax. If the call tree exists, the key syntax is effectively called, and being able to detect whether the key syntax is effectively called, thereby ensuring the effectiveness of code detection in experimental teaching or examinations. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The present invention is further described below in conjunction with the accompanying drawings and embodiments;
[0018] Figure 1 Shown is a flow chart of a method for determining a question according to an embodiment of the present invention.
[0019] Figure 2 Shown is a sub-flow chart of the question determination method according to an embodiment of the present invention.
[0020] Figure 3 Shown is another sub-flow chart of the question determination method according to an embodiment of the present invention.
[0021] Figure 4 Shown is another sub-flow chart of the question determination method according to an embodiment of the present invention.
[0022] Figure 5 Shown is another sub-flow chart of the question determination method according to an embodiment of the present invention.
[0023] Figure 6 Schematic diagram showing the creation of a call tree according to an embodiment of the present invention
[0024] Figure 7 Shown is a structural diagram of a question judging system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.
[0026] In the description of the present invention, unless otherwise clearly defined, words such as "setting" should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meaning of the above words in the present invention in combination with the specific content of the technical solution.
[0027] In the process of evaluating the code, if the code is run directly and the result of the code running is compared with the standard answer, if the result of the code running is the same as the standard answer, the result of the code evaluation is full marks, otherwise, the result of the code evaluation is zero; evaluating the code by comparing the difference between the result of the code running and the standard answer may not be able to test a certain knowledge point and require students to apply the knowledge point; if the code is compared with the reference answer code, the higher the similarity, the higher the code evaluation score; evaluating the code by comparing with the reference answer code may overemphasize the similarity with the answer, exclude multiple implementation methods, and it is difficult to achieve the purpose of accurately evaluating code ability.
[0028] Based on this, the present invention proposes a method for judging questions, which aims to achieve the purpose of assessing designated knowledge points without being restricted to applying standard answer templates, while ensuring the same accuracy as manual inspection, realizing the automation of code evaluation and improving the efficiency of evaluation.
[0029] A method of judging a question, such as Figure 1 As shown, the specific steps are as follows:
[0030] S100, constructing a key grammar, where the key grammar includes at least one key element;
[0031] S200, reading the code and identifying whether the code contains the key syntax;
[0032] S300, determining whether all key elements in the key syntax included in the code are effectively called;
[0033] S400, outputting the judgment result according to whether the key syntax is effectively called or the running status of the code.
[0034] Different from the prior art, the present invention constructs key syntax based on keywords. If the code contains key syntax and the key syntax is effectively called, it means that the code meets the assessment requirements in terms of syntax. The quality of the code is comprehensively evaluated in combination with the output calculation results, which can more accurately evaluate the code quality.
[0035] The detailed implementation of the above steps is described below in multiple embodiments.
[0036] Before step S100, the process also includes: formatting the code to be evaluated into a unified form for storage. The storage formats of codes written on different platforms are different. To simplify the code reading step, the present invention formats the code to be evaluated into a unified form for storage.
[0037] Step S100, as Figure 2 As shown, specifically including:
[0038] S110, obtain common keywords or keywords according to the type of programming language to build a keyword library. Among them, keywords are strings with specific meanings specified by the language. Keywords are strings with specific meanings specified by the language, and different language keywords have differences. For example, the keywords of C++ are private, public, and protected; the keywords of Python are row and column. Therefore, it is necessary to build keyword libraries of different languages and select key syntax from the keyword libraries. For example, the keyword libraries corresponding to C language and C++ are shown in Table 1-2.
[0039] Table 1. C language keyword library
[0040]
[0041] Table 2. C++ keyword library
[0042]
[0043] S120, select at least one keyword or keyword from the keyword library as a key element to construct a key grammar. The key grammar mainly evaluates whether the code is programmed according to the specified knowledge points from the grammatical level. For example, in the experimental class, it is required to use a for loop statement to implement the output of the multiplication table. The implementation code is as follows:
[0044] #include "stdio.h"
[0045] main (){
[0046] int i, j, result;
[0047] for ( i=1; i<10; i++){
[0048] for ( j=1; j<10; j++){
[0049] result=i*j;
[0050] printf ("%d*%d=%-3d",i,j,result); / *-3d means left alignment, occupies 3 digits* /
[0051] }
[0052] printf("\n"); / *New line after each line* /
[0053] }
[0054] };
[0055] The knowledge point of this test is the use of for loop, so main, int, for are selected from the C language keyword library as key syntax. In addition, key syntax can also be constructed in a user-defined way.
[0056] Before step S200, the following steps are also included:
[0057] Identify and filter invalid code in the code to be evaluated. Invalid code is mainly non-programming language comments. Comments are mainly used to explain the meaning of the code to make the mechanical code more semantic. Therefore, the commented part is meaningless for the code evaluation. Therefore, it is necessary to filter out the commented part and extract the valid code for evaluation. Generally, comments have fixed signs. For example, in C language, comments generally use " / / " or " / ** / " to mark the beginning and end of the comment.
[0058] In order to check whether students have used designated knowledge points for programming, the prior art generally involves teachers conducting one-on-one spot checks. The idea of the present invention is to evaluate the code from multiple perspectives, both in form and substance. Formally, evaluating the code refers to checking whether the code contains key syntax corresponding to designated knowledge points to examine students' ability to apply the knowledge points. Essentially, evaluating the code refers to checking whether the key syntax is effectively called to avoid students simply listing the key syntax without actually using it to edit the code.
[0059] Step S200, as Figure 3 As shown, specifically including:
[0060] S210, obtaining a regular expression based on the key syntax, the regular expression is used to match specific key elements; searching the key elements according to the regular expression to confirm whether the code contains all the key elements of the key syntax.
[0061] S211, write a regular expression based on the keywords in the key grammar to query whether the string contains all the key elements in the key grammar.
[0062] In one embodiment, the code is read and stored in a string array, and the query whether the code contains the key syntax is converted into the question of whether the string contains another string. For example, the read code file is written into a string variable for storage, and a regular expression is written based on the keywords in the key syntax to query the code string. Does it contain all the keywords in the key syntax? If the code string If the keywords in the key syntax match those in the code, it can be preliminarily determined that the code formally meets the requirements of the examination.
[0063] S212, write a regular expression based on the keywords in the key grammar, and query whether the word vector contains all the key elements in the key grammar.
[0064] In one embodiment, a word segmentation algorithm can be used to convert the code into a word vector, and the query code can be converted into a word vector query to see if it contains key syntax. For example, since the code has a fixed format, the code can be segmented according to the carriage return character, ignoring meaningless symbols such as brackets, and finally the code segmentation result is:
[0065] {"main()", "int i, j, result;", "for ( i=1; i<10; i++);", " for ( j=1; j<10; j++)", "result=i*j;", "printf ("%d*%d=%-3d",i,j,result);", "printf("\n");"}
[0066] Write a regular expression based on the keywords in the key grammar, and query whether the word vector contains all the keywords in the key grammar. If the word vector matches the keywords in the key grammar, it can be preliminarily determined that the above code formally meets the requirements of the inspection.
[0067] Calculation is the basic function of code. Generally speaking, the final calculation result will be output. If the variables or functions associated with the keywords are output directly or indirectly, it means that the keywords are effectively used in the code rather than simply listed.
[0068] Step S300, as Figure 4 As shown, specifically including:
[0069] S310, obtaining the definition of a variable or function or determining a regular expression using a rule, and extracting the variable name or function name associated with the key element in the code through the regular expression.
[0070] In one embodiment, the variables or functions associated with a keyword are generally in the same word vector, and the word vector containing the keyword "int" is: "int i, j, result;", where the variables associated with the keyword are "i", "j", and "result". For example, the following regular expression is defined,
[0071] Divide the string by "int" and return a list "i, j, result;"
[0072] Use "," to divide the string, get the variable "i", and return a list "j, result;"
[0073] Use "," to divide the string, get the variable "j", and return a list "result;",
[0074] Use ";" to divide the string, get the variable "result", and return a list "", and end.
[0075] Extract variables "i", "j", and "result" in the word vector according to the regular expression;
[0076] In one embodiment, the word vector "int result (int a, int b);" containing the keyword "int" contains the variables "a", "b" associated with the keyword, and the function "result" associated with the keyword. The function has a fixed format, such as fun_name (parameter_1, parameter_2), and the regular expression can be determined according to the definition rule of the function, so as to extract the function "result" associated with the keyword "int" and the function's parameters "a", "b".
[0077] Tracking the calling path of variables or functions associated with keywords. Since the assignment transfer between variables and the parameter transfer in functions have the characteristics of one-to-many, the tree is essentially a one-to-many structure. The present invention uses the tree to map the calling path of variables or functions associated with keywords.
[0078] S320, determining a first variable or a first function associated with the keyword, mapping the calling path of the first variable or the first function by means of a tree, and obtaining a calling tree of the first variable or the first function, then the key element in the code is effectively called, such as Figure 5 As shown, specifically including:
[0079] S321, assuming that the first variable is the root node, if the root node is called by the second variable or the second function, the second variable or the second function is the first child node of the root node, the root node and the first child node constitute the call tree, when the first child node does not exist, the first variable to be printed out or the first variable to be updated is the second child node of the root node, the root node and the second child node constitute the call tree. Among them, the first variable is any one of the associated variables, the first function is any one of the associated functions, the second variable or the second function is any one of the first child nodes of the root node, it should be noted that the tree construction process is a recursive process, the child node can continue to track the calling status of the variable or function corresponding to the child node as the root node.
[0080] In one embodiment, if Figure 6 As shown, assuming that the first variable or the first function associated is A, where A is the root node, if A is the second variable or the second function Call, then is the child node of A, where Among them, m means that A is called by m variable names or function names, that is, A has m child nodes, and so on. As the root node, continue tracking , until the last variable or function is no longer called, where For the leaf nodes of the tree, get the call tree of the variables or functions associated with the keyword.
[0081] S322, set the first function as the root node; if the root node is called by the second variable or the second function, set the second variable or the second function as the first child node of the root node, then the root node and the first child node constitute the call tree; when the first child node does not exist, the variable printed out or the updated global variable in the first function is the second child node of the root node, and the root node and the second child node constitute the call tree.
[0082] In one embodiment, a call tree of a function associated with a keyword is constructed, and D is assumed to be a function, and the node corresponding to D is the root node. It should be noted that any node can be regarded as a root node, and the root node described in the present invention does not specify the root node of the entire tree. A tree can also be regarded as composed of multiple subtrees.
[0083] (1) Function D is called:
[0084] a. If function D has a return value, the variable that calls function D is the second variable or the function that calls function D is the second function, and the second variable or the second function is the first child node, then the calling status of the first child node is tracked;
[0085] b. If function D has no return value, determine whether function D prints the variable value. If function D prints the variable value, the printed variable is the second child node, and the calling status of the second child node is tracked; otherwise, determine whether function D updates the global variable. If function D updates the global variable, the global variable is the second child node, and the calling status of the second child node is tracked; otherwise, D is a useless function, and the single branch path above the node corresponding to D is removed.
[0086] (2) Function D is not called: D is a useless function, and the single branch path above the node corresponding to D is removed.
[0087] For example, to create a call path mapping tree for the "max" function, the code is as follows:
[0088] #include<stdio.h>
[0089] int max(int num1, int num2); / * function declaration* /
[0090] int main () {
[0091] int a = 100; int b = 200; / * local variable definition * /
[0092] int ret;
[0093] ret = max(a, b); / * Call function to get the maximum value* /
[0094] printf( "Max value is : %d\n", ret );
[0095] return 0;}
[0096] int max(int num1, int num2) / * The function returns the larger of the two numbers* /
[0097] {
[0098] int result; / * local variable declaration* /
[0099] if (num1>num2) result = num1;
[0100] else result = num2;
[0101] return result;
[0102] }
[0103] (1) Assume that the function "max" is associated with a keyword. Now create a call path tree with "max" as the root node:
[0104] (2) Use regular expressions to locate the code line containing "max" "ret = max(a, b);"
[0105] (3) Define a regular expression with the help of the assignment symbol "=" to extract the variable name "ret" that calls the "max" function. The variable "ret" is the child node of the function "max". There are two formats of function calls. One is a call without a return value, such as "max(a, b);", and the other is a call with a return value, such as a variable call "ret =max(a, b);". For example, when it is called by another function "fun", "fun (max(a, b));" can be used to define a regular expression in the above function call format to extract the called function or variable.
[0106] (4) The regular expression locates the code line containing "ret" "printf( "Max value is : %d\n", ret );" where the variable "ret" is output and is the leaf node of the tree.
[0107] S323: If the root node has no child nodes, the root node is a useless node, the single branch tree corresponding to the root node is deleted, and the call tree is updated.
[0108] In one embodiment, the step of constructing a call tree of a function associated with a keyword, assuming V is a variable, and the node corresponding to V is the root node:
[0109] (1) When variable V is not updated:
[0110] If the variable V is called by a function or other variables, when V is called by another variable, the variable is the second variable; when V is called by a function, the function is the second function, and the second variable or the second function is the first child node. At this time, the calling status of the first child node is tracked;
[0111] If variable V is not called by a function or other variables, and variable V is printed out, then variable V is the second child node. At this time, the calling status of the second child node is tracked; otherwise, V is a useless variable, and the single branch path above the node corresponding to V is removed.
[0112] (2) If the variable V is updated, then the variable V is the second child node. At this time, the calling status of the second child node is tracked.
[0113] For example, create a call path mapping tree for the "a" function, and associate the variable "a" with the keyword:
[0114] (1) Use regular expressions to locate the code line containing "a" "ret = max(a, b);"
[0115] (2) According to the function tracking method, we know that the variable name "ret" calls the "max" function, where the variable "a" is used as the parameter of the "max" function and is called by the "max" function. At this time, we transfer the tracking to the "max" function;
[0116] (3) According to the tracking method of the “max” function, “ret” is the child node of the “max” function, and the variable “ret” is output as the leaf node of the tree.
[0117] S330, if all the key elements in the key grammar contained in the code are effectively called, and the result output by the code running is consistent with the answer, the question judgment result is excellent, otherwise the question judgment result is poor.
[0118] The present invention is based on the one-to-many relationship between the calls of variables or function parameters, and uses a tree to construct the calling path of variables or functions for mapping. Calculation is the main function of the code. Generally, the code can print specific values. The code prints the calculation results and the parameter calls have one-to-many characteristics. The present invention determines whether the variables or functions associated with the key syntax are effectively called by constructing a mapping tree, thereby determining whether the key syntax is effectively used. It can detect whether the code completes programming according to the specified syntax, ensuring the effectiveness of code detection in experimental teaching or examinations.
[0119] In a second aspect, an embodiment of the present invention further provides a system for determining a question, such as Figure 7 As shown, specifically including:
[0120] A first module is used to construct a key grammar, wherein the key grammar includes at least one keyword;
[0121] The second module is used to read the code and identify whether the code contains key syntax;
[0122] The third module is used to determine whether the key syntax in the code is called effectively;
[0123] The fourth module is used to output the judgment result according to whether the key syntax is effectively called or the running status of the code.
[0124] The third module specifically includes:
[0125] The call tree construction submodule is used to determine the first variable or the first function associated with the keyword, and map the call path of the first variable or the first function by means of a tree to obtain the call tree of the first variable or the first function.
[0126] In one embodiment, the second module queries whether the code contains the key syntax constructed by the first module. If the code contains the key syntax, it further determines whether the key syntax in the code can be effectively called. By determining the variables or functions associated with the key syntax, the call tree construction submodule creates multiple call path mapping trees of variables or functions associated with the key syntax. If each variable or function associated with the key syntax can build a call tree, it means that the key syntax is effectively called. The fourth module obtains the output calculation result based on whether the key syntax is effectively called or the running status of the code. The higher the quality of the code, the more the key syntax is effectively called and the code output result is consistent with the answer.
[0127] It should be appreciated that the method steps in the embodiments of the present invention can be implemented or implemented by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer readable memory. The method can use standard programming techniques. Each program can be implemented in a high-level process or object-oriented programming language to communicate with a computer system. However, if necessary, the program can be implemented in an assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, the program can be run on a programmed ASIC for this purpose.
[0128] Furthermore, the operations of the processes described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) that is executed collectively on one or more processors, by hardware, or a combination thereof. The computer program includes a plurality of instructions that may be executed by one or more processors.
[0129] Further, the method can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, a RAM, a ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the process described herein. In addition, the machine-readable code, or portions thereof, can be transmitted via a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention also includes the computer itself.
[0130] The computer program can be applied to input data to perform the functions described herein, thereby converting the input data to generate output data stored in a non-volatile memory. The output information can also be applied to one or more output devices such as a display. In a preferred embodiment of the present invention, the converted data represents physical and tangible objects, including specific visual depictions of physical and tangible objects produced on the display.
[0131] The embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.
Claims
1. A method for determining a question, characterized in that: The following steps are involved: constructing a key grammar, the key grammar comprising at least one key element; Reading the code and identifying whether the code contains the key syntax; Determining whether all key elements of the key syntax contained in the code are effectively called; Outputting the judgment result according to whether the key elements are effectively called or the running status of the code; Wherein, the identifying whether the code contains the key syntax includes: Obtaining a regular expression based on the key grammar, wherein the regular expression is used to match key elements; Searching the key elements according to the regular expression to confirm whether the code contains all the key elements of the key syntax; Wherein, the determining whether the key element in the code is effectively called includes: A first variable or a first function associated with a key element is determined, and a calling path of the first variable or the first function is mapped by means of a tree to obtain a calling tree of the first variable or the first function, so that the key element in the code is effectively called.
2. The method for determining a question according to claim 1, characterized in that: The specific method of constructing the key grammar includes: Obtain common keywords or keywords based on the type of programming language to build a keyword library; At least one of the keywords or the keywords are selected from the keyword library as key elements to construct a key grammar.
3. The method for determining a question according to claim 1, characterized in that: The method for obtaining the first variable call tree includes: Let the first variable be the root node; If the root node is called by a second variable or a second function, assuming that the second variable or the second function is the first child node of the root node, the root node and the first child node constitute the call tree; When the first child node does not exist, the first variable that is printed out or the first variable that is updated is the second child node of the root node, and the root node and the second child node constitute the call tree.
4. The method for determining a question according to claim 1, characterized in that: The method for obtaining the call tree of the first function includes: Let the first function be the root node; If the root node is called by a second variable or a second function, assuming that the second variable or the second function is the first child node of the root node, the root node and the first child node constitute the call tree; The first child node does not exist, the variable to be printed out or the global variable to be updated in the first function is the second child node of the root node, and the root node and the second child node constitute the call tree.
5. The method for determining a question according to any one of claims 3 or 4, characterized in that: The method for obtaining the call tree of the first variable or the first function further includes: If the root node does not have a child node, the root node is a useless node, the single branch tree corresponding to the root node is deleted, and the call tree is updated.
6. The method for determining a question according to claim 1, characterized in that: The output judgment result includes: If all the key elements in the key grammar contained in the code are effectively called, and the result output by running the code is consistent with the answer, then the judgment result is excellent, otherwise the judgment result is poor.
7. A question judging system, characterized in that: include: A first module is used to construct a key grammar, wherein the key grammar includes at least one key element; The second module is used to read the code and identify whether the code contains the key syntax; The third module is used to determine whether all key elements of the key syntax contained in the code are effectively called; The fourth module is used to output the judgment result according to whether the key elements are effectively called or the running status of the code; Wherein, the second module is also used for: Obtaining a regular expression based on the key grammar, wherein the regular expression is used to match key elements; Searching the key elements according to the regular expression to confirm whether the code contains all the key elements of the key syntax; Wherein, the third module includes: A call tree construction submodule is used to determine the first variable or the first function associated with the key element, and to map the call path of the first variable or the first function with the help of a tree to obtain a call tree of the first variable or the first function, so that the key element in the code is effectively called.
