Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. Tools
  4. Autograded Coding Quizzes for Assessment

Autograded Coding Quizzes for Assessment

Scheduled Pinned Locked Moved Tools
1 Posts 1 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

    Formative Assessment for Learning Scratch

     
    MIT’s Scratch platform offers a dynamic environment for open-ended projects, where millions of students develop and share creative games and stories. However, assessing student learning in Scratch-based coding classes has traditionally been limited to multiple-choice questions, which may not fully capture a student’s coding skills.

    The CreatiCode platform enhances Scratch by enabling hands-on coding problems for formative assessment. This allows teachers to identify gaps in student understanding early and provide tailored learning materials to support individual progress.

     

    Overview

     
     

    CreatiCode enables teachers to create automatically graded hands-on coding quizzes, such as Parsons Problems. These assessments provide a more effective alternative to multiple-choice questions by directly evaluating students’ coding skills in a practical context.

    This process takes 4 steps:

    1. Create a new project, which asks the students to complete a task by adding/changing the blocks in it.

    2. Add “secret” code to this project to automatically grade the student’s work and submit the result. Auto-grading can be done using ChatGPT or your own logic.

    3. Create a new “quiz” using the project

    4. Create a new “assignment” using the quiz that includes due dates.

    Now, let’s walk through this process with a complete example.

     
     
     
     
     

                                                                                                                      
    

     
     

    Create a Coding Challenge Project

     
     

    Step 1 - Remix a Starting Template

    First, please remix the following project:

    https://play.c reaticode.com/projects/6593e905a3c834dd5277053f/editor

     
     

    Step 2 - Overview of the First Sprite

     

    You should see 2 sprites in this project. The first sprite is called “Sprite1”.

    This is where the student will make changes to complete the challenge. This example is a Parsons problem, since all the blocks needed by the student are given in the “short list” on the left, so students just need to compose them into a working program. A rich-text comment is added to the green flag block, which explains the task:

    0c01167b-af55-481d-9ceb-d7f5faec3586-image.png

     
    You can change the short list to any set of blocks. For example, you can provide more blocks than necessary, or no blocks in the short list at all.

    You can also change which blocks are given in the editor as the starting point of the quiz. For example, you can add more blocks so students only need to work on the new blocks they have just learned. You can even provide an incorrect program for the students to fix.

    In this example, we are asking students to attach blocks to the “when green flag clicked” block, which is the most natural starting point, since students can simply click the green flag to test their work. However, you might choose to ask the student to add new blocks below a different type of hat block, such as “when I receive message” or “when this sprite is clicked”, etc.

     
     

    Step 3 - Overview of the Secret Sprite

     

    The second sprite in this project is named “Secre_t”. Note that you need to rename it to “Secret” so that it is hidden from any other user. That is, when students open or remix this project, they will not see this Secret sprite.

     
    441067b9-deee-4a5c-9f46-7e42dcc12b0b-image.png
     
    This sprite contains 2 stacks of blocks. The first stack is used to store the correct solution, and the second stack uses ChatGPT to evaluate the student’s code against some rubric. We will look into each stack below.

     
     

    Step 4 - Compose the Correct Solution in Sprite1

     

    To automatically evaluate whether a student’s program is correct or not, it is often necessary to know the correct solution. This is especially important if we need to use ChatGPT to evaluate the student’s code, as it sometimes fails to correctly analyze student’s code without a correct solution as reference.

    Therefore, in this step, let’s build a solution program based on the challenge:

    f8ee5ad0-a209-413d-bac1-963fdb563e45-image.png

     
     

    Step 5 (Optional) - Set up the project’s initial state

     

    When the student’s code is triggered by the “when green flag clicked” block, there is one common issue: we can not specify the initial state of the program. For example, suppose we want to test the student to always initialize a variable before using it. The best way to do that is to set that variable to a random value BEFORE the student’s code runs, so if the student’s code doesn’t initialize that variable correctly, it will be using a random variable value.

    To make this easy, the CreatiCode playground offers a new block “prepare for green flag click”, and any code attached to this block will run before the blocks under the green flag block. For example, we can initialize the “number” variable like this:

    84287f75-f9a2-4396-a482-08309a993f7c-image.png

     
     
     
     
     

                                                                                                                      
    

     
     

     
     

    Add Code to Grade the Student Solution Automatically

    One of the key advantages of creating quiz problems using the CreatiCode platform is that the project for students to work on and the logic to evaluate student solution are both stored in the same project. This makes it much easier to create or update such quiz problems.

    After the teacher shares the project with their students, the students will remix this project, and implement their solution. Then, when they click the green flag, the logic in the “Secret” sprite will be triggered to automatically grade the student’s solution.

     
     

    Step 1 - Save the Correct Solution as Text

     

    Since we can not operate on blocks directly, the first step is to convert the correct solution to text format.

    To do that, switch to the “Secret” sprite, and run these 2 blocks:

    fd062bb4-5e02-4632-a7eb-320f890f52ec-image.png

     
    The first block will read all the information (e.g. blocks, costumes, etc) about Sprite1, and store them in the given list “script”. The first item in the list will be the text representation of the code blocks in Sprite1, and we will store them in the variable “solution code”.

    In this example, the “solution code” variable will have the following value, which is the program in Sprite1 in pseudo code format:

    0b4898fd-3106-470a-b64f-99b342e1bd95-image.png

     
     

    Step 2 - Read the Student’s Code

     

    To automatically grade the student’s code, we also have to read the student’s code from the Sprite1 into “my code”, similar to how we read the reference solution. This is done whenever the green flag is clicked, as we assume the student has remixed our quiz project and completed the code changes.

    e75f0f58-c5d3-4fef-a393-a721daf8afcc-image.png

     
    For example, suppose this is the student’s solution, which fails to change the “number” variable by 1 in the repeat loop:

    578ff864-5d6e-41eb-b709-8f51921e3712-image.png

     
    Then “my code” will have the following value:

    833f995b-a5fc-4cfb-95eb-119d4e60b5e9-image.png

     
     

    Step 3 - Send Quiz Information to ChatGPT

     

    At this point, we know both the correct solution and the student’s solution (both in pseudo code format), and there are several methods for analyzing the correctness of the student’s solution. The most generic and robust solution is to ask ChatGPT to do the grading for us. We will need to compose a fairly long prompt to fully explain what we need ChatGPT to do, and provide all the information it needs.

    To get started, we need to tell ChatGPT its task, and give it the quiz’s rubric and the reference solution:

    5b38c72c-70d4-4083-ae43-a63a808b6d98-image.png

     
    Note that to change this code based on your quiz problem, you need to make 2 changes:

    1. Update the rubric (the green text) in the comment box. The rubric should describe what the student’s code is expected to do, and any other requirements like which blocks should be used. Since we are only giving information to ChatGPT at this step, we only need to ask ChatGPT to respond with a “Yes”. This is a commonly used technique to avoid long responses from ChatGPT.
    2. After updating the rubric, copy the entire content of the comment box and paste it into the “set [info prompt] to” block below it. After that, the “info prompt” and the “solution code” will be joined into the final request we send to ChatGPT.

     
     

    Step 4 - Ask ChatGPT to Evaluate the Student’s Code

     

    Now, we are finally ready to ask ChatGPT to evaluate the student’s code against the requirement. Since we have already told ChatGPT about the quiz, the rubric and a reference solution, we only need to give it any additional requirements on the format of its response and the actual code from the student:

    164c9429-2d9a-450d-b646-8e1d9adee6b6-image.png

     
    The prompt asks ChatGPT to respond with “PASS” or “FAIL” first. And in case of “FAIL”, it will ask ChatGPT to also provide additional explanations.

    Note that you don’t have to modify this part of the code in most situations. However, if you have some special requirements on how ChatGPT should write the feedback, you can modify the prompt in the comment box, then copy it into the “set [evaluate prompt] to” block.

     
     

    Step 5 - Display ChatGPT’s feedback to the student

     

    After running the blocks above, the “result” variable will contain the response from ChatGPT. We can show that in an “alert” window like this:

    38c77938-7674-4a2d-81eb-4a4e3123fbf6-image.png

     
     

    Step 6 - Submit the Evaluation Result

     

    Lastly, we will need to submit the evaluation result to the CreatiCode server, so that we can review all results as a teacher.

    9982cc1a-cebd-45f0-8a15-a5285810564f-image.png

     
    We can check if the result starts with “FAIL” or not, and set the assignment to be “fail” or “pass”. We will also store the student’s code and the full response from ChatGPT. You will learn where to view these results below.

     
     

    Step 7 - Share the Project

     

    Now, we are done with creating the quiz problem. It has to be shared so that students can open and remix it. Usually, you can use “share unlisted” (so only users with the exact URL can open the project) or “share with password” (users need to input a password to open the project).

     
     

    Alternative Methods for Evaluating Student Code Automatically

     

    Instead of asking ChatGPT to grade the student’s solution, there are 2 other methods worth mentioning here.

    First, for coding challenges with very simple and fixed solutions, we can analyze the student’s code text directly. For example, we can check if the value of “my code” contains the text “change [number v] by (1)”, or we can check the value of the “number” variable after a few seconds. Of course, this method may not work well when there are multiple ways to solve the challenge.
     
     
    Second, a slightly more robust method is to use the console log. To do that, the quiz can require the students to write code to print certain information in the console in our rubric. For example, instead of “say” the number, ask the student to print 1, 2, 3 in the console panel using the print block:

    849671cc-641f-4c03-8d1d-28955475e902-image.png

     
    Next, in the Secret sprite, we can wait a few seconds after the green flag is clicked, then check the console log’s content. We can read its content using the “get console log” block, then verify if the log is the same as expected. You can specify the expected output directly like “1\n2\n3”. Alternatively, you can run the correct solution, save the console log from it into a variable, then compare that with the console log produced by the student’s code when the student runs the program.

    b50cdcbf-345f-48b9-98e6-f1eb506ec7fb-image.png

     
     
     
     
     

                                                                                                                      
    

     
     
     

    Create a Quiz

     
     

    After creating a coding project with autograding logic, we can create a quiz using that project.

    First, go to the “My Stuff” page in the CreatiCode playground, and find the “Quizzes” tab on the left:

    cb5e4a72-be76-4c22-b54a-94a29d011e29-image.png

     
    Next, click the “Add a new quiz” button, and fill in the following information:

    2c725ef1-8e75-4858-8633-8a0f8bb93fc3-image.png

     
    You can assign any name to this quiz, and copy the URL of the project you created above. The “Custom XO Prompt” is reserved for the future, and you can leave it as blank for now. The “Notes” is any additional notes you would like to add for yourself. After clicking “Add”, you will see a new quiz in the list:

    fa40fb66-c454-487b-9402-0c84853e7423-image.png

     
    For each quiz, there are 3 links available:

    • You can click “View Project” to open the project associated with that quiz to review or update it.
    • You can click “Edit” to change the name, project link or note for this quiz.
    • You can click “Delete” to remove this quiz.

     
     
     
     
     

                                                                                                                      
    

      
     

    Create a Class Assignment

     
     

    Now, we can create an assignment using the quiz created above. The key difference between an assignment and a quiz is that assignments have due dates, and they can be assigned to a class of students.

     
     

    Step 1 - Create a class and add your students

     

    If you haven’t done so, you need to create a class under “My Classes”, as described in this tutorial: Teacher Only: How to Manage Students in the “My Classes” Page

     
     

    Step 2 - Create a new assignment

     

    To create an assignment for any class, select that class in the “My Classes” page, and switch to the “Assignments” tab, which will display all assignments you have created for this class:

    bdde88c1-3261-42d1-9553-60834684d8f8-image.png

     
    Click the “+ New assignment” button on the top right to add a new assignment:

    e43fdedd-797d-461d-827e-a89e5a261d8b-image.png

     

    • For “Quiz”, you can select a quiz from the dropdown. If you don’t see the new quiz you just added, refresh the page to update the list.
    • For “CreatiCode XO”, you can choose to disable it so that when the student opens this project in the playground, the CreatiCode XO button will be hidden.

     
     

    Step 3 - Students work on the quiz

     

    After the start time of the assignment, students will see a “start” link next to the assignment on their “My Class” page:

    e87cb728-599b-4ae1-a541-2982c9f5b9df-image.png

     

    When a student clicks “start”, the project shared by the teacher will be remixed into a new project in this student’s account. This way, the student can make changes to it and save it.

    Whenever they click the green flag button to test their solution, the evaluation results will be submitted to the CreatiCode database by the code in the Secret sprite (invisible to the students). If they run it again, the new result will overwrite the previous ones.

    d71a26ce-848a-42b7-8704-abd8de57d6ea-image.png

    Also, the student can choose to restart the project using the “restart” link after it has started:

    c9b5b339-a045-49cb-ba5c-93ed9829e00a-image.png

     
    When “restart” is clicked, a new remix project will be created from the original project shared by the teacher.

     
     

    Step 4 - Teacher Reviews Results

     

    Teachers can review these results using the “Activity” link next to the assignment:

    aa6bd86a-6143-487b-9a3a-ea9098709334-image.png

     
    The results will be displayed in a popup window. It will show the “Status” of “Pass” or “Fail”, as well as the explanation and code submitted from the Secret code.

    67a2e43f-375e-4122-a7a5-86a56fd9a966-image.png

    1 Reply Last reply
    1
    • CreatiCodeI CreatiCode pinned this topic on

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode