Code questions are unique to the Mimir Classroom platform and allow instructors to evaluate a higher order demonstrated thinking and problem-solving. 

These questions act as a simple project with test cases used to evaluate the success of a solution and automatically assign points. Like project test cases, instructors can hide some test cases from students to ensure that students aren't 'coding' to pass the test case.

Code question also feature a playback that allows the Instructors to watch the student's approach to solving the problem. The playback can provide instructors with additional information that can be used to adjust a score or provide more informed feedback. 

Plagiarism reports can be run on assignment code questions. These reports helps maintain academic integrity for even the more simple problems or challenges.

Currently we support IO, Unit, Code Quality and Custom test cases within assignment coding questions.

Example

As an example, we will create a simple factorial snippet in Python 3.4.

  1. create or enter an assignment, fill out the information in the first stage, then move on to stage 2 (Questions).

  2. Now hover over 'Create New Question', and click coding problem. This should create a new form in the assignment builder below.

  3. Fill out the top section, including question name, number of points, whether or not the code problem is required, description, and perfect code. Perfect code is what we will test against your test cases you will set up below.

Important!---------------
The point value you set for the project will be the total points for all test cases. Depending on how you set the weights for the test cases, this will allow for partial credit in respect to the weights of the test cases.For example:If you have 4 test cases, each with equal weight, and the problem is worth 10 points, if a student passes 3 of the 4 tests they will receive 7.5 points for the problem.
---------------

The perfect code we used with this example is below:

def factorial(n):
  '''return the factorial of n'''
  if n == 1:
    return 1
  return factorial(n - 1) * n

if __name__ == '__main__':
  '''ask for a number n from stdin and print the factorial'''
  n = int(input())
  print(factorial(n))

While not required, we suggest that you also fill out starter code, giving your students a starting point for solving the coding question. This also gives them a standardized starter of the code you want them to write so that you can create unit tests knowing they will have it set up like you want it.

Our starter code:

def factorial(n):
  '''return the factorial of n'''
  # TODO: finish this method
  return 0

if __name__ == '__main__':
  '''ask for a number n from stdin and print the factorial'''
  pass

Once you've filled that all out, you can start to make test cases.

Important!

---------------

Much like regular project test cases, each test case has options for revealing helpful feedback to  your students via the toggle switches at the bottom of the test case dialog. If you want to be sure that the test case will not give away any information, make sure that you toggle off every option for that test case. While we take measures to make sure the test case code does not leak, If you leave on 'Show Input', 'Show Output', or 'Show Correct Output', you are potentially risking giving away the test case.

---------------

For the sake of our example, here are some basic test cases we set up (These test cases are by no means extensive or complete, only examples of some of the things you can do):

Custom Test (tests to make sure the implementation is less than 20 lines):

lines=$(wc -l < code.py)
if [ $lines -lt 20 ]; then
  echo true > OUTPUT
else
  echo false > OUTPUT
fi

Unit Tests:

assert factorial(2) == 2
assert factorial(30) == 265252859812191058636308480000000

IO Test Input:

3

IO Test Output:

6

What it looks like to students

After setting up your coding problem and saving the assignment, you can preview what it will look like to your students. Our example looks like this:

The student will have the starter code by default in their coding area, and will see every test case that has been setup below. When they start coding, they can hit the save button or Ctrl+S to save their progress and automatically run all of the test cases. That makes sure that the student will get feedback fast and often. The details buttons on the right side will allow them to see anything for each test case that you have allowed them to see. This also means that if you don't give them any feedback, the test case will just say failed and will not give them any more information than that.

Did this answer your question?