VPL Question

Question types ::: qtype_vplquestion
Maintained by Astor Bizard
VPL Questions are questions that can fit within a Moodle quiz. They are intended to create small to medium coding exercises, based on the Virtual Programming Lab plugin. They are designed to offer a simple interface for students, while keeping the power and versatility of Virtual Programming Labs.
Latest release:
479 sites
185 downloads
44 fans

VPL Question type

Version: 2.0.0 (April 2024)

Authors:

  • Astor Bizard
  • Florent Paccalet (legacy version).

This software is part of the Caseine project.
This software was developped with the support of the following organizations:

  • Université Grenoble Alpes
  • Institut Polytechnique de Grenoble

Introduction

VPL Questions are questions that can fit within a Moodle quiz. They are intended to create small to medium coding exercises, based on the Virtual Programming Lab plugin.
They are designed to offer a simple interface for students, while keeping the power and versatility of Virtual Programming Labs.

For example:
VPL Question example: Hello World

VPL Questions Architecture

A picture is worth a thousand words, so here is how it works (you can also read the thousand words right below the picture!):

VPL Question architecture

A VPL Question is (as its name says) based on a VPL (Virtual Programming Lab).
The execution and evaluation of the question takes place inside that VPL, which allows powerful customizations.
A single VPL can be used for several questions, as long as it is located in the same course.

In order to execute and evaluate student's code in the VPL, the question sends that code (injected within the required file, at the place of the {{ANSWER}} tag) in a new VPL submission. The submission also includes question-specific execution files. The VPL then replaces its own execution files by the ones present in the submission.
This is what allows several questions to be based on the same VPL: as the execution files are question-specific, different execution behaviors (e.g. different test cases) can be achieved on the same VPL. However, this can not be achieved for standard execution scripts.

Create a VPL Question

Step 1: Create a dedicated VPL

The first step to create a VPL Question is to create the VPL it will be using.
To do so, simply create a new VPL inside your course.
It is (strongly) recommended to create it inside a hidden section of the course, and make it available. The goal is to hide it from students, while still allowing them to make submissions to it.

When the VPL is created, there are a few settings you will have to change before it can be used:

  • Edit settings > Submission period: It is recommended to disable the deadline (Due date).
  • Edit settings > Submission restrictions: Set the Maximum number of files to a large enough number, as submissions will include execution files.
  • Edit settings > Common module settings: If you put the VPL inside a hidden section, make sure the Availability is set to Available but not shown on course page.
  • Execution options: Set Run and Evaluate to Yes.
  • Execution files: Create a file named pre_vpl_run.sh, and paste the following code in it (this is the code that deals with submitted execution files):
for qvplfile in `ls -1`
do
     file=${qvplfile%_qvpl}
     if [ -x $file ]; then executable=true; else executable=false; fi
     test "$qvplfile" != "$file" && mv "$qvplfile" "$file"
     if $executable; then chmod u+x $file; fi
done
  • Required files: Create one (and only one) required file. You can write some basic code in it (like class declaration in java, an empty main function, ...).

You can also edit/add execution files. Please note that:

  • Standard execution scripts will not be editable per-question. Please edit them from the VPL.
  • Other execution files will be editable per-question. However, please create them first in the VPL (you won't be able to create them from a question).

IMPORTANT: Students submissions on this VPL will be discarded by the VPL Question (this behavior can be changed by an administrator in this plugin settings). This is why it is important to create a dedicated VPL (and not to use a VPL where students may want to retrieve their previous submissions).

Step 2: Create one or more VPL Questions

Once a dedicated is created by following the instructions above, you are now ready to create your VPL Questions !
To do so, create a question either from a Quiz or a Question bank, and select VPL Question:
VPL Question type select

Let's breakdown what you can do in the question editing form:

  • General: You fill find here all standard settings for a question, like question name and description.
  • VPL Question template: Here you can select the VPL you created earlier. This will allow you to edit the required file. Please make sure that it includes the {{ANSWER}} tag: this is where the student's code will be injected. Also, please note:
    • Code written here will not be visible by students.
    • The changes you make to the required file will only be effective for the current question.
      Required file template edition
  • Answer template: Here you can edit what will be pre-filled in the student's answer box. It can be left empty.
  • Teacher correction: Please write here your correction for the question. This is what will be used as the "Correct answer" for Quiz feedback.
    If Validate is checked, the provided answer will be checked against test cases upon question save. This is very useful to check everything is working fine on VPL side, and that both your correction and your tests are correct.
  • Execution files and evaluate settings: This is where you can edit the execution and evaluation behavior of the question. Once again, all modifications done here will only affect the current question.
    • You can edit execution files (most commonly vpl_evaluate.cases). If there is an execution file that you created in the VPL but you do not need in this question, write UNUSED at the beginning of the file: it will be ignored.
      Note: Execution files are only sent to the VPL upon question evaluation. If you need them during execution (Run), please set them as Files to keep when running in the VPL.
    • You can also change the behavior of the Pre-check button (make it act as the Debug button on the VPL, use the execution files above, or use other files). In the last case, you will be able to edit another set of execution files, this time specific to the Pre-check button.
    • You can finally decide whether students need to achieve perfect VPL grade to get the question correct, or use relative VPL grade to get a proportional note on the question.

Known issues

  • Test cases hacking
    Test cases, along with other execution files specific to a question, are sent to the VPL as submission files. Even if the VPL is hidden, it has to be available to students so that they can submit to it. This leads to a possibility for students to find access to the VPL, thus to the execution files they submitted. Please be aware of that possibility - what you decide to do about it is up to you.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6

Contributors

Astor Bizard (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments

Mostra comentaris
  • Astor Bizard
    dv., 15 de març 2024, 22:21
    Hello,
    If your VPL is on version 4.2 or above, the latest version that you need is 1.9.0 for VPL 4.2+ (2024030700), as the name indicates Complicitat
    Best regards,
    Astor
  • Stephan Domanowski
    dj., 21 de març 2024, 23:02
    Hello Astor,
    Unfortunately it still doesn't work for me.

    A brief explanation. My system:
    Moodle: 4.1.9+ (Build: 20240315)
    VPL: 4.2.3 (2024011312)
    VPL Question: 1.8.1 for VPL 4.2 (2023100301)

    In the update overview, the following is displayed as new for the question type of this version: 1.9.0- for VPL up to v4.1
    If I install the version "1.9.0 for VPL 4.2+ (2024030700)" manually, I am still shown that this version is newer: 1.9.0- for VPL up to v4.1
    The problem with the display also reappears with the manually installed version.

    When I look at the version requirements, I am a little surprised:
    1.8.1 for VPL 4.2 (2023100301) > $plugin->requires = 2022041900; // Moodle 4.0.
    1.9.0 for VPL 4.2+ (2024030700) > $plugin->requires = 2018051700; // Moodle 3.5.
  • Astor Bizard
    dv., 22 de març 2024, 18:16
    Hi @Stephan Domanowski,

    I understand that the plugin versions management can be confusing, especially to users.
    Given your current version, the latest compatible version of VPL Questions is "1.9.0 for VPL 4.2+ (2024030700)".
    You see the "1.9.0- for VPL up to v4.1" as newer because its version number is higher than the latter.
    Why is it so?
    Well, Moodle store won't allow several versions to have the same version number.
    So, I have to upload two versions with different version numbers, one of which will always be higher.
    The version requirements are declarative minimal compatible version, which does not seem up-to-date ; I will fix it in the next upload.
    My main concern about Moodle versions was also about Moodle store: I wanted both versions to show up for users, and the only way to do so was to declare that they support different Moodle versions.

    Now, to sum it up for your usage:
    Installing version "1.9.0 for VPL 4.2+ (2024030700)" will give you the latest version compatible with your system.

    I hope this makes it a little clearer!
    Best regards,
    Astor
  • Johannes Burk
    dt., 14 de maig 2024, 22:14
    I've no option to open an issue on the bug tracker since I can't login. So I write it as a comment here:

    The check weather to use wss or ws if "mod_vpl | websocket_protocol" is set to "depends_on_https" for the evaluation is broken: https://gricad-gitlab.univ-grenoble-alpes.fr/moodle-plugins/moodle-qtype_vplquestion/-/blob/d6520a9083da55dd278c79903e9c0fc14fd737c2/locallib.php#L101
    $_SERVER['SERVER_PROTOCOL'] contains just "HTTP/1.1" for example and no info about HTTPS. You want to check for $_SERVER['HTTPS'] == 'on'
  • Astor Bizard
    dc., 15 de maig 2024, 21:05
    Hi @Johannes Burk,

    You are indeed correct. I created the corresponding issue, and this will be adressed in the next release.
    Thank you for your feedback and research!

    Astor
  • Stephan Domanowski
    dc., 24 de jul. 2024, 21:31
    Hello!
    I am currently testing different elements for the migration to Moodle 4.4+.
    I noticed something: The creation page of a VPL question looks a bit torn apart by spacers.

    I have put some SCSS in the system to restore the look:
    body#page-question-type-vplquestion .fcontainer .fitem:not(:last-of-type) {margin-bottom: 0 !Important;}
    body#page-question-type-vplquestion .fcontainer #fitem_id_execfileslist {padding-bottom: 0;}

    I have not tested version 4.2 and 4.3.
    It would be nice if this could be considered in one of the next versions.
    (PS: I could not register in GitLab. Error during the registration process).
  • Astor Bizard
    dc., 24 de jul. 2024, 22:50
    Hi @Stephan Domanowski,

    Thank you for the insight. I'm logging this into gitlab, and will include it in the next release to support 4.4.

    Best regards,
    Astor
  • Frauke Sprengel
    dj., 20 de febr. 2025, 01:52
    If you try to save a new VPL question, you get the errors

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$templatevpl is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$templatelang is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$templatecontext is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$answertemplate is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$teachercorrection is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$validateonsave is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$execfiles is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$precheckpreference is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$precheckexecfiles is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022

    Deprecated: Creation of dynamic property qtype_vplquestion_question::$gradingmethod is deprecated in /var/www/html/moodle/question/type/questiontypebase.php on line 1022
  • Astor Bizard
    dj., 20 de febr. 2025, 17:21
    Hello @Frauke Sprengel,
    This was already fixed in a released version. Please upgrade to the latest available version and you should not experience this problem anymore.
    Best regards,
    Astor
  • Fabrizio TORRE
    dj., 8 de maig 2025, 19:21
    Hi Hastor,
    I wanted to thank you for the plugin.

    I can't integrate R with VPL Question.

    When I click run inside the quiz the output box doesn't produce anything.

    The code works fine on a normal VPL activity.

    I don't have any integration issues with C or JAVA projects.

    Thank you very much in advance.
  • Astor Bizard
    dl., 19 de maig 2025, 15:18
    Hello @Fabrizio TORRE and sorry for the late answer.
    It seems that VPL, by default, runs R programs within a graphical interface.
    This is not supported by VPL questions.
    You would need to rewrite the vpl_run.sh script to run the program as command line.
    Sorry for the inconvenience.
    Best regards,
    Astor
  • Luiz Gustavo Cordeiro
    dj., 11 de set. 2025, 03:32
    Hi, Astor.

    I just started creating VPL questions and have a question myself.

    To avoid creating several dedicated VPLs - one for each question - could I simply create a single dedicated VPL for my questions and use it for all my VPL questions (since they are somewhat basic)? Since the execution files and evaluation settings are set up directly in the VPL question, I do not see why this would not be possible. I noticed that when configuring the VPL question, the evaluation files in the VPL are modified, so this might lead to uncontrolled behaviour.

    Anyway, I made a small test with two distinct questions based on the same VPL, on the same questionnaire, with distinct evaluation behaviours, and everything seemed to work fine.

    Is this the correct (or at least an acceptable) way of setting up VPL questions? If so, wouldn't it be better to simply set up a "empty" VPL instance which is initialized along with the VPL question?

    Thank you very much for the wonderful plugin.
  • Astor Bizard
    dj., 11 de set. 2025, 17:03
    Hello @Luiz Gustavo Cordeiro,
    I am glad you find the plugin useful!

    This is indeed a correct way to use VPL Questions! This is even the intended way to set them up Somrient

    The reason we are not using a virtual, empty VPL activity is that we often want to setup generic, sometimes advanced, evaluation mechanism. In that case, we put it in the base VPL activity, and it can be easily re-used across multiple questions.

    Best regards,
    Astor
  • Jack Gohler
    dc., 7 de gen. 2026, 18:28
    Subject: Feature Request: HTML5 Support for Evaluation Output Window
    Hi,
    First of all, thank you for this great plugin – it's exactly what we were looking for.
    About us:
    We're an educational organization that teaches programming to thousands of high school students. We're currently migrating our assessment system to VPL and have decided to use the VPL Question plugin as our main solution.
    The challenge:
    Our students have little to no background in computers or programming. Because of this, we're looking for ways to present feedback in a more visual and beginner-friendly way.
    Currently, the evaluation output window (vpl_eval_details_q208) only supports plain text. This limits us in two ways:

    Formatting limitations: We can't use visual elements to make feedback clearer and more accessible for young learners.
    RTL/LTR mixing issues: Our feedback combines Right-to-Left text (Hebrew) with English code and terms. In plain text, this mix breaks the display and creates confusing, garbled output. With HTML5, we could use proper dir attributes to handle bidirectional text correctly.

    Feature request:
    Would it be possible to add HTML5 support to this output window (or introduce an alternative output area that supports HTML)?
    This would allow us to:

    Use colors and formatting to highlight errors vs. successes
    Properly handle bidirectional (RTL/LTR) text
    Add visual elements to make feedback clearer
    Create a more encouraging experience for beginners

    We'd be happy to provide more details about our use case or help test if needed.
    Thanks for considering this!
  • Kay Otto
    dc., 7 de gen. 2026, 19:10
    Hi Astor,
    I recently got aware of a possible issue with the conditions under which a VPL-Question answer is saved during a running Moodle quiz.
    Our testing specs:
    - Moodle: 5.1.1+ - Build 20251212
    - VPL: 4.4.1 - 2025112512
    - VPL-Jail Server: 4.0.3
    - VPL Question: 3.3.0 for Moodle 4.2+ - 2025121601

    When a Moodle quiz is running and the student sees a VPL-Question, his code seems to solely be saved when (1) he executes / pre-checks the code (button interaction) or (2) if he navigates to the next or previous question (also a button interaction). Nevertheless, when editing the answer in a VPL Question, after 30 seconds or so a message appears on the right side that pretends that the answer is being saved, together with a timestamp. Actually, this seems to have no effect - the answer is not really saved. If the quiz has a time limit and the limit runs out, the student is automatically redirected to the results page where he can have a look at the answers he gave in the quiz and he will find that his latest inputs in the recent VPL-Question that was open before the automatic closing of the quiz are not present. He sees only the version of his answer that was stored when he executed his code. Without any execution / pre-check, he will find his answer completely empty.
    The behaviour of the standard free-text questions is different: Even the latest input, e.g. just one second before an automatic closing of a time-limited quiz, is reliably stored and thus visible to the student in the result page. I assume that the finish / redirect event somehow triggers a submit for the answer. For real examination scenarios, this would be the preferred behavior also for VPL-Questions. Otherwise, a student could lose parts of his answers that he did'nt have the time to execute or pre-check shortly before the quiz runs out.

    I assume that this is related to the VPL Question plugin, or am I missing something? Can we control this behaviour by configuration?

    Thanks in advance.

    Best regards
    Kay
1 2 3 4 5 6 7
Please login to post comments