What are code questions?

The code questions allow students to write code as answers in various programming languages.

In addition, for specific languages*, the examinees can also run the code.

This feature allows instructors to include code template files within the questions, allowing students to view, edit, and run tests during the exam.

You can add automatic tests to these files, automatically calculating the student's grade for the question. 

How to create a code question in the exam editor (TomaEditor)

The code question can be selected from the question types menu on the side of the question editor.

When a question is of the "code question" type, you can choose between two modes

1. Without files

2. With files.

Without files

It is possible to limit the examinees to answer in a specific programming language or choose the "Any" option and allow them to select any language available from the list:

In addition, you can choose if the examinees will be able to run the code, or not.

Attention! If the programming language chosen is not one of the supported languages, the option for the students to run the code will not be available. 

with files

In this mode, code template files can be added to the question.

By clicking on the arrow next to each uploaded file you can set the following parameters:

- Running the code: Allowing examinees to run the code.

- Running tests: These are tests that the examinees will be able to execute during the exam. 

To add inputs, the user needs to enter the values in the ‘input’ textbox and click the "+" button for each additional input. Next, the user should provide the corresponding output and click the "Add Test" button. 

Tests can be removed by using the trash icon next to each test

- Automatic tests - These tests will be executed in the background after the student completes the exam and will adjust the student's grade based on their results. To add inputs, the user needs to enter the values in the ‘input’ textbox and click the "+" button for each additional input. After that, the user should provide the corresponding output. 

Finally, the user needs to decide the weight of this test in terms of points and click the "Add Test" button. Tests can be removed by using the trash icon next to each test.

Please note that the total score for all tests should correspond to the score set for the question

The uploaded file will be displayed in the CodeMirror editor with adjusted syntax highlighting:

Please note that it will not be possible to confirm the exam in the following cases:
- The template files were not uploaded
- The total score of the automatic tests does not match the question's grade
- The option to add tests (manual or automatic) was selected, but no test was added

IDE-Based Coding Question

Students can be allowed to work in an integrated development environment (IDE) as follows:

1. Create a ZIP file containing all relevant files for working with the IDE in the exam (folders can also be zipped)

2. Select the "External IDE Question" type from the question types menu

3. The available IDEs will appear below.

- Click to select the environment, and click again to deselect. You can select more than one environment.

- Note that the selection for Windows computers (1) and Macs (2) is done separately.

4. After selecting the environment or environments, upload the ZIP file with the relevant files

Currently Supported IDEs:

  • Visual Studio (Windows computers only)
  • Visual Studio Code

Soon to be supported:

  • PyCharm
  • IntelliJ

* Additional IDEs will be added later.

How to check the student's uploaded files

Read here how to download and check the answered files in TomaGrade

* List of supported languages

(Languages that support adding template files, running, and testing)

  • C

  • C++

  • Python

  • Java

  • PHP