Page tree
Skip to end of metadata
Go to start of metadata

This Wiki page introduces a simple CodeRunner example, where the task is to write a program that calculates the volume of ideal gas (TODO: link the XML file for the question. The XML file can be imported to Moodle).

Table of contents

Introduction

Here is how the simple exercise looks like inside a Quiz:

The students write their answer in their favorite code editor (for example, Spyder). Then they paste the solution to the Answer box and click Check. MyCourses will submit the answer to a Jobe sandbox, which is a small cloud-based server. The server runs the code and tests and returns the results to MyCourses. If the answer is correct, the output show in the figure below is printed. The Expected column shows what kind of output CodeRunner expects and Got column shows what the student code prints. There can be an arbitrary number of tests and they can be much more complex than just comparing simple outputs. More complex tests are introduced in the other sections of the Wiki.

 

If the student submits an incorrect answer, the output looks as below. The Show differences button is very helpful as it highlights the differences in the expected output and the output from the student.

Settings for a CodeRunner question

 Let's see how simple CodeRunner questions are set up.

Start by adding a new question in a Quiz or in a Question bank (if you are not familiar with Quizzes, please see Aalto MyCourses Help).

Choose CodeRunner as the question type:

MyCourses opens a new page Editing a CodeRunner question. The question type is well-documented and you can click the question mark symbols for context-based help. Here we will go through the very basic settings needed to set up a simple exercise.

CodeRunner question type

Question type: python3

Customization: Do not check any boxes. This setting is explained in the Wiki pages dealing with more advanced questions.

Answer box: You can set the number or rows in the student answer box. For our example here, it is 15. For a very short code of just few rows, you could make the box even smaller. And for longer codes, a larger box might be helpful so that students can properly see their code before they submit it for checking. But always make it clear for the students that they should write and test their answers in a separate code editor, not directly in the CodeRunner answer box. It is very important that the students learn to use a proper code editor and learn to test their own code. 

Precheck: Disabled. This option can be used for more sophisticated testing of student answers.

Feedback: Force show strongly recommended. Coding questions make little sense if the students do not get proper feedback.

Marking/All-or-nothing: Here we check All-or-nothing grading, which means that the students only get points from their answer when all tests pass successfully. It is possible to give per-test grades, but this probably makes sense only for relatively complex coding assignments. For simple programs or functions, the code either works or not. In other words, you can build CodeRunner quizzes in two ways: (1) You can have several shorter questions with All-or-nothing grading, each of which gives few points (or zero). (2) Or you can have a larger coding assignment, where you then use per-test grading and give fractional points. Smaller questions are usually easier to manage and and they are typically easier for students to understand in an introductory course.

Marking/Penalty regime: Here we set Penalty regime to 0. This means that the students have unlimited attempts with no penalty. This is a good setting for very basic questions where students are practicing the very basics. For more advanced exercises, one certainly should set up a penalty regime as this encourages students to rigorously test their own codes before submission. Penalty setting "0, 0, 0, 10, 20, ..." would mean that students can first submit three times without a penalty, after which MyCourses starts to add a penalty of 10% per incorrect submission. Penalty setting "10, 20, ..." would mean that MyCourses starts to penalize incorrect submissions immediately from the first attempt. It is strongly recommended that you give the students at least one penalty-free submission so that they can get rid of any possible technical issues that did not arise in their own coding environment, but arise in the CodeRunner environment (another possibility would be to implement the Precheck-option mentioned above).

Template params: For simple python3 programming exercises, this can usually be left empty. This setting can be used for the randomization of initial values and there is a separate Wiki page dedicated to randomization in CodeRunner questions.

Twig controls: For simple python3 programming exercises, there is no need to change these options. Typically, Hoist template parameters is checked and Twig all unchecked. Twig all setting will be checked if you do randomization of CodeRunner questions.

Question type details

CodeRunner documentation on the selected question type (python3 in this case)

General

TODO

Answer

TODO

Answer box preload

TODO

Global extra

TODO

Test cases

TODO

Support files

TODO

Attachment options

TODO

Tags

TODO



  • No labels