Examples
IVProg allows automatic exercises to be made available directly on Web pages. If the teacher has an installation of the Moodle manager with the iTarefa package, then the activity performed by the student will be recorded, as well as the grade assigned to the student's solution.
The automatic evaluation in the iVProg is made from a template, which must have been prepared by the teacher, providing data inputs and their respective outputs. When the student "click" on the button to evaluate their solution, iVProg uses the first list as inputs to the student's problem, comparing each generated output with those of the list of outputs.
To better understand the process, let's use an example algorithm that must sum separately all the numbers positive and negative signals entered by the user.
Problem:
Make an algorithm that prompts the user to enter integer values, finalizing their execution when typed the value zero. At the end, your program should print the sum of all positive integers that were typed and then print the sum of all negative integers.
How can I prepare a exercise template with automatic evaluation in iVProg
The teacher can prepare any number of lists of entries and exits, for the above problem, we will use only 3 lists, shown in the table below. The first column has the number of the "input/output" pair, the second shows the list of inputs (separated by white space), in the third column are the expected outputs (for those inputs) and the last column has a short explanation about the pair.
# | Inputs | Outputs | Comments |
---|---|---|---|
1 | 0 | 0 0 | This is a tricky test, because if the first entry is zero, nothing will be added (then 0 and 0 should be printed) |
2 | 1 -1 1 0 | 2 -1 | It presents 2 positive and 1 negative values, with sums respectively 2 and -1 |
3 | -1 -1 3 1 0 | 4 -2 | It presents 2 positive and 2 negative values, with sums respectively 4 and -2 |
IVProg has a special interface for the teacher to enter each list of inputs and outputs.
How does iVProg automatically evaluate a student solution?
Assuming that the student has built an algorithm, when he "click" the button to evaluate your solution, iVProg:
- It takes the first input from the first list and submits it to the first reading in the student code (error if it does not exist), then the second input and so on until the last one.
- The first output (print command) generated by the student code is compared to the first expected output if it matches a hit is recorded, if not an error.
- Repeat steps 1 and 2 for each of the other lists of inputs/outputs and at the end an average of hits and errors is generated.
For example, if the student algorithm is wrong in 2 of the 6 outputs, its grade will be 1/3.
To open the example, click on its title. You can hide it again by clicking on the same title.
Exercise example with automatic evaluation in iVProg.
Make a program that prompts the user for an integer value, then print the value typed by the user.
Exercise example with automatic evaluation in iVProg.
Construct an algorithm that prompts the user to enter a number (integer) and prints the square of that value.
Exercise example with automatic evaluation in iVProg.
Construct an algorithm that receives two integers and prints the sum of these values.
Exercise example with automatic evaluation in iVProg.
Construct an algorithm that receives two integers from the input, calculates the arithmetic mean of those numbers, and prints it.
Exercise example with automatic evaluation in iVProg.
Construct an algorithm that receives two integers from the input and prints the higher of the two numbers.
Exercise example with automatic evaluation in iVProg.
Make an algorithm that prints the sequence of integers from 1 to 10.
Exercise example with automatic evaluation in iVProg.
Build an algorithm that prints the word iVProgH 10 times.
Exercise example with automatic evaluation in iVProg.
Make an algorithm that reads a sequence of integers, adding them until a value of zero is entered, at which point you must print the value of the sum and stop.
In this example, construct an activity, inserting the test cases that will be used to evaluate the algorithm and configure the resources that will be made available to the student in iVProgH.