Grades FAQ


Q: The autograder says: "Unable to find expected line. Reached end of file..."

The autograder looks for certain pieces of your output so it knows where to beginning grading. Because of this, you need to make sure that your output matches exactly with what the autograder is looking for. For example if the autograder is looking for: "Student Scores:", but your output only says "Student Scores" (missing a colon) then the autograder will not be able to find the place to start grading, make it all the way to the end of the file without finding it and then output that line:

Unable to find expected line. Reached end of file...

Q: I have some weird error with Valgrind and I don't know what it means

Memory leaks can be frustruating bugs to track down. Valgrind is a useful tool to help narrow down where the leak is occuring.This page on the website can help you to begin to understand how to read the output from Valgrind and how to narrow down where in your code you should start looking.

Some things to remember that can hopefully help you to debug:

  • Any time you say the word new you always need a delete to get rid of it, somewhere in your code.
  • Pay attention to the scope of your objects. Did the thing you called new on go out of scope before you got a chance to delete it?
  • Some Valgrind errors are not memory leaks, but are actually caused by your code accessing "bad memory", usually meaning you tried to access outside of the bounds of your array. Make sure you always know what your code is doing and check that you don't ever try to access out of bounds somewhere. Breakpoints and stepping over on an IDE can be very useful to debug these types of errors.

Q: My code compiles fine on my machine, but when I submit it, it says: "Compilation Failed"

Sometimes your IDE will make assumptions for what you want to do without you actually telling it to. This is super nice if you forget to do something while coding, but it can cause a real issue if you try to run your code outside of an IDE. g++ doesn't make any assumptions for you, so something that worked while you were coding it up might not work when you submit it.


For example, If you say:

int counter;
counter++;
Visual Studio will assume you wanted counter to be initialized to 0, but when this is run on g++ it will just be initialized to some random spot in memory which will break your code.

Another issue you might face in this lab particularly is setw making your code not compile on the autograder. Again, an IDE might just grab the library needed for this, but g++ won't, so make sure you are using #include<iomanip> in order to be able to use setw

Q: Can I only use one array to hold all the information?

You can use as many arrays that you want to hold all of your information. In fact this lab is much easier if you create a seperate array for different things (one array for all the scores, one for all the students, one for all the averages, etc.).
Just make sure that you are dynamically allocating every single array yourself (i.e. string* namesArray = new string[numStudents])and are not using any STL containers.