In Programming II we will have programming exercises as homework every week. You'll submit your solutions to these exercises to ReCodEx, a system that evaluates and scores your solutions automatically.
When you upload a program, ReCodEx compiles it and runs it against a number of test cases. Each test case consists of a certain input that will be sent to your program, plus the output that is expected in response to that input. Your score for the exercise is determined by the fraction of test cases that your program passes. In my classes, the maximum possible score for each exercise is typically 10 points. If you submit a program and it earns less than this maximum, you are welcome to fix your program and submit again. I allow up to 50 resubmission attempts (other teachers may set a different number).
To test the efficiency of your solutions, each test case includes limits for the amount of memory and execution time that your program is allowed to use. To pass a test case, your program must
produce the correct output
not use too much memory
not take too long to run
not crash, exit with an unhandled exception, or return an error code to the operating system
To test the efficiency of your solutions, each test case includes limits for the amount of memory and execution time that your program is allowed to use.
Here is some general advice for submitting programs to ReCodEx.
First, each exercise's description usually includes at least one sample input and expected output. Be sure to test your program on this sample input on your own machine! It is wisest to test your program on a variety of inputs before you upload it to ReCodEx.
Your program must produce exactly the output that ReCodEx expects, with no extra verbiage. For example, if ReCodEx expects the answer "7" on a single line and you output "x = 7", the test case will fail. Similarly, do not print any input prompts; ReCodEx does not expect them. (ReCodEx will, however, generally ignore trailing spaces on any output line.)
For most exercises, your output lines must appear in a certain order, but in some exercises they may appear in any order. If that is the case, the exercise description will say so.
If your submission does not pass all the test cases on the first attempt, do not despair! Many students' programs will not pass on the first attempt. The test cases are often designed to test edge cases and unusual inputs, and will often test your program on large input values or with large amounts of input data. So your program may be largely correct but still fail several test cases.
If your score is less than the maximum, be sure to look at the test results in the lower-right-hand corner of the window. They will look something like this:
Each row represents one test case. The columns represent, in order:
correctness of the result
(You can mouse over the icons at the top to remind of you each column's meaning.)
Look at what went wrong. Usually the problem is that the program wrote the wrong output, but it may be that your program produced the correct answer but took too long.
If the output was incorrect, think about possible cases where your program could produce an incorrect result. Try different inputs when running the program on your own machine, and look at your code again to see if there are possible bugs or unhandled edge cases.
If your program used up too much memory or ran too slowly, you will need to find a more efficient algorithm. Again, some ReCodEx test cases are designed specifically to test whether your program is efficient.
If, in the end, you are convinced that your program is correct and you are baffled as to why some test cases are failing, you may email me to ask for a hint. Of course, I may not always be available shortly before the deadline. For that and other reasons, I highly recommend starting early on these exercises every week. Some exercises may be challenging, and it may take some time to think about each exercise and come up with a complete working solution.