Programming Interaction
The question type programming interaction is a special input interaction. If participants enter program code, this code will be evaluated either by defined test cases or a template with a corresponding return value. The automatic assessment is done using an interface for the server application VPL . Supported programming languages include C, C++, Haskell, Java, JavaScript, Mathlab/Octave and Phython3.
A licence is required to use this question type.
Related Topics
Further information
Best practice
Question
Function | Description |
---|---|
Question | Questions come with a WYSIWYG editor. This allows you to design your questions to your liking and include media and formulas. |
Score | By default, the maximum score for the question will be displayed. To change this setting, switch to the Scoring tab. |
Answers
Answering a programming interaction is done by entering program code. To do this, the participant has access to a code editor with syntax highlighting. The author must choose the desired programming language and can enable an automatic assessment.
Function | Description |
---|---|
Auto Assessment | By enabling this option, you allow the programming interaction to be automatically assessed. You can choose whether the assessment should be done using Test cases or the Return value of a template. If automatic assessment is not enabled, the question will be manually assessed, and the participant will receive a corresponding notification during the test or in the results view. |
Programming language | Select the expected programming language for entering and evaluating the question. Supported programming languages include C, C++, Haskell, Java, Java, JavaScript, Mathlab/Octave, Phython2 and Phython3. |
Scoring | If automatic assessment is enabled, you can choose from two scoring options:
|
Test cases | If the option Test cases has been selected for scoring, a corresponding input field will be displayed. Test cases must be entered in VPL syntax. Each test case must be described as follows:
Any number of test cases can be defined. Scoring is done according to the number of correct test cases. For the program code written by the participant, it is checked whether the defined output will be reached using the corresponding input. The number of successful test cases in relation to the total number of test cases will then result in the score, calculated as a percentage of the maximum score defined by the author. The VPL documentation gives an overview of the VPL syntax and shows more examples in the section Creating automated tests. |
Template | Regardless of the selected scoring option, the author may define program code as a template in which the program code entered by the participant will be integrated. The placeholder {LEARNERRESPONSE} defines where exactly the participant input will be inserted. If no template has been defined, the program code of the participant will be executed on its own. The template can be used in addition to scoring. If the scoring option "return value of template" has been configured, the program code must return a percentage value as a console output in the following format:
|
Solution | The hint at the solution will be displayed to the participant as a sample solution, e.g. while they are running a test for which solutions have been enabled, or in the results view after completing a test. |
Pre-defined content | If you enter pre-defined content, the input field in test run will be pre-filled with that text. The user may change this content. |
More information
Code editor
For entering the program code, both the participant and the author have access to a special code editor based on the ACE editor (https://ace.c9.io/). In particular, this enables an improved overview due to syntax highlighting, specific indentation and outdentation, and program code-specific operator support. The editor will be preconfigured according to the selected programming language.
Results report (VPL output)
The results data contains the full VPL output as a text file. This file will be stored in the data archive for each test run and participant. In the future, testers may look forward to a direct output display in the results views.
Use Cases
In order to understand the possible default settings and the functionalities of the VPL interface, we provide some sample content here.
You will find a file with two task versions for each programming language: One is configured with a frame file and the other is configured with a case exam. Download the samples and import them into your question bank. The section Creating Resources describes how to import tasks.
Sample tasks with orientation to the Saxon curriculum: