What are Code Questions?
Code questions allow you to write code as an answer in a variety of programming languages.
Depending on the lecturer's settings, you may also run the code and perform tests.
It is important to note that running code and tests is possible only when connected to the internet. Offline execution of code and tests is not supported.
There are two types of code questions: with files and without files.
Code Question - Without Files
In this mode, a blank CodeMirror editor will be presented, where you should write your answer.
- If the lecturer has restricted the possible programming language for the answer, you will only be able to respond in the specified language.
- If no programming language restriction is applied, you will be able to choose the language from a dropdown list.
- Running Code
If the lecturer has enabled code execution, a "Run Code" button will appear.When clicking the button, the output of the code execution will be displayed in the response area below the button.
The "Run Code" button will not appear if the lecturer has not enabled it.
Code Question - With Files
In this mode, a tab will be displayed for each code template file that the lecturer uploaded to the question.
The tabs are located above the CodeMirror editor.
If the lecturer has enabled code execution for the selected file, a "Run Code" button will appear in the response area.
When clicking the button, the output of the code execution will be displayed in the response area below the button.
If an error occurs while trying to execute the code, the error details will be displayed in the text area.
Running Tests
If the lecturer added the ability to perform tests for a file, a "Run Tests" button will be added.
When running tests, the results will be displayed in a window with the following details for each test:
- Test number
- Input
- Expected output
- Output
- Result
If an error occurs during execution, the error details will be displayed.
A file may include both code execution and tests. In such cases, both buttons, "Run Code" and "Run Tests," will appear:
Marking the Question as Answered
The question will be marked as "answered" (with a green background and an increase in the progress percentage) after the first change is made in any of the files.
Note that it may take up to one minute for the "Answered" mark to appear.
Code question in development environment (IDE)
To answer these types of questions, the relevant environment must be installed on your computers.
If there is such a question in the exam, the following prompt will appear (example for a question that requires the Visual Studio environment):
You will need to download the zip file attached to the question to your computer.