CodeGrade Help
Go to websiteAPI docsContact us
  • 🏠CodeGrade Help Center
  • ❓FAQ
    • Using CodeGrade in Safari
    • Using sections
    • Configuring roles of members
    • Archiving your course
    • Adding new members
    • Releasing grades and feedback
    • Exporting Submissions
    • Choosing a grading scale
    • Creating course-wide snippets
    • Course Gradebook
    • Allowing students to hand in after the deadline
  • Use built-in content
    • 👥Community Library
    • 🐍Introduction to Python Curriculum
  • Create your own assignments
    • 1️⃣Build your assignment
      • ➕Create assignment
        • ➕Standalone
        • ➕In Blackboard
        • ➕In Brightspace
        • ➕In Canvas
        • ➕In Moodle
        • ➕In Sakai
        • ➕In Open edX
        • 💾Importing a previous assignment
      • ⚙️General settings
      • 📋Add Rubric
      • 🤖Add Automatic Grading
      • 🧑‍🎓Student View
    • 2️⃣Grade your assignment
      • ✏️Give Feedback
      • 💯Give a Grade
    • 3️⃣Analyze your assignment
      • 🕵️‍♂️Detect Plagiarism
      • 📊Analytics
      • 🎓View and export grades
    • *️⃣Other features
      • AI Assistant
      • 👥Peer Feedback
      • 🫂Group Assignments
      • 🙋Collaborative Grading
      • 🕶️Anonymous Grading
      • 🛡️Manage Course Permissions
      • 📬Hand In Requirements
  • Automatic Grading Guides
    • 🏗️AutoTest V2 Blocks
    • ✏️Quizzes
      • ❓Multiple Choice Question
      • ❓Select All Question
      • 💻Coding Question
    • 🐍Python
      • 🐍Create your first Python assignment
      • 🐍Advanced Python autograding
    • ☕Java
      • ☕Create your first Java assignment
      • ☕Advanced Java autograding
    • 📘Jupyter Notebook
    • 🐬MySQL
    • 🌐Web Development
      • 🌐Web Development with Selenium
      • 🎨Automatically grading CSS
    • 🟨JavaScript
      • 🟨Create your first JavaScript assignment
      • 🟨Advanced JavaScript autograding
    • 📊R
    • ©️C
      • ©️Create your first C assignment
      • ©️Advanced C Autograding
    • 🖥️C#
      • 🖥️Create your first C# assignment
      • 🖥️Advanced C# autograding
    • ➕C++
      • ➕Create your first C++ assignment
      • ➕Advanced C++ autograding
    • 🐘PHP
      • 🐘Create your first PHP assignment
      • 🐘Advanced PHP autograding
    • 🏗️Code Structure Tests with Semgrep
  • For students
    • 🚀Getting started
      • 🚀Getting started in CodeGrade
      • 🚀Getting started in Blackboard
      • 🚀Getting started in Brightspace
      • 🚀Getting started in Canvas
      • 🚀Getting started in Moodle
      • 🤷‍♂️I forgot my CodeGrade username / password
    • 🧬Advanced Features
      • 👥Handing in with a group
      • 📥Handing in using Git
      • 📝Giving Peer Feedback
      • 🏆Doing a Final Exam
      • ❓Asking Questions
      • 💳Enrolling in a paid course
      • 🎟️Using a coupon to enroll in a course
      • ⏪Refunding a paid course
  • 📘APIv2: Typescript
  • 🐍APIv1: Python
  • 🤖APIv1: Docs
  • 🌐Our Website
  • ✉️Contact us
Powered by GitBook
On this page
  • Create a Coding Question Test
  • Hiding information from the student
  • AutoTest Snapshot and Test Student Submission
  1. Automatic Grading Guides
  2. Quizzes

Coding Question

PreviousSelect All QuestionNextPython

Last updated 11 months ago

To assess students' understanding of programming concepts effectively, creating specific questions that require them to produce code snippets can be very beneficial. A Coding Question follows this precise workflow: students read the question and then write a code snippet as their answer in the Online Editor. As a teacher, you can subsequently run automatic tests on the code produced by the students to evaluate their solutions.

Students can fill in Quizzes only by using CodeGrade's Online Editor. For an assignment that includes quizzes, it is therefore necessary to have the Online Editor as the only allowed way of creating submissions. In this case, it is also convenient to enable the , so that students are navigated to the Editor automatically when launching an assignment.

Create a Coding Question Test

To create a Coding Question, first add a Quiz Block and then include a Coding Question Block within it.

In a Coding Question Block, you can set:

  • The name of the Block so that the student knows what the question is about;

  • A description of the question, by filling in the Question field. This field supports markdown so that you can format the text or include links to external resources, such as in the following example:

Complete the following code snippet so that it prints the first 20 [prime numbers](https://en.wikipedia.org/wiki/Prime_number).
  • The name of the file that the student will produce;

  • A Starter Code Template that the student will start working with. For instance, you may provide a partially filled code snippet, as in the example below:

def is_prime(num):
    if num < 2:
        return ___
    for i in range(2, ___):
        if num % i == ___:
            return False
    return ___

prime_numbers = []
current_number = ___

while len(prime_numbers) < ___:
    if is_prime(___):
        prime_numbers.append(current_number)
    current_number += 1

print(prime_numbers)

The image below shows an example where, for a Python assignment, an IO Test Block is used to check that the student's code snippet produces the expected output:

Hiding information from the student

As explained in the guides for the different programming languages, teachers can select which information about a Test Block should be revealed or hidden from the student. The same holds for Test Blocks that are part of a Coding Question: it will be sufficient to use Hide Blocks just as with regular Test Blocks!

To make Quizzes graded, remember to wrap a Connect Rubric Block around them.

Quizzes can be used in combination with Run-If blocks. You may, for example, run other tests conditionally on the results of a Quiz.

AutoTest Snapshot and Test Student Submission

With your Coding Question Block now set up, click the bottom right Build Snapshot button to build your AutoTest Snapshot. The first time you build a snapshot, you are required to upload a Test Submission; in this case, you have two options:

Option 1: uploading a dummy file

  1. You can upload a dummy file. The file you upload doesn't matter, it's just there to allow you to build and publish your snapshot. Your Coding Question will fail as the answer file has not been filled in yet. Nonetheless, you should go on and publish your snapshot.

  2. Navigate to the Submission Overview page and click on the Test Submission.

  3. Open the Test Student submission in the editor by clicking the top right Edit button.

  4. Fill in the answer file Coding Question, delete the dummy file you submitted in point 1, and finalize the submission by clicking the Hand in button in the bottom right corner.

  5. Go Back to the AutoTest configuration and click the Build Snapshot button again. This time you should see your Coding Question Tests passing. If not, go back to point 2 to correct the Test Submission or edit the AutoTest configuration to change your tests.

Option 2: uploading the answer file

  1. Alternatively, you can also upload the actual answer file for the Coding Question. It is essential, in this case, that the file you upload has the same name that you set for your Coding Question.

  2. By building the Snapshot, you can now check that the test submission achieves full scores. If not, go back to point 2 of Option 1 to correct the Test Submission or edit the AutoTest configuration to change your tests.

After building and publishing your snapshot, the student can fill in the Coding Question and receive feedback in the Online Editor as shown below:

After the student submits their answer, you can evaluate their code using the full capabilities of AutoTest. Within the Coding Question framework, you have access to all the available Test Blocks that facilitate grading workflows. These are detailed in our guides for different programming languages, like our or guide for example.

Also, with Quizzes, you can that the student can make.

✏️
💻
Python
Java
Simple Submission Mode
limit the number of submissions
The configuration of a Coding Question.
An Input Output test is used to test the student's code snipper for a Coding Question.
An example of feedback that the student receives when filling in a Coding Question in the Online Editor.