Exams and tests
Weekly programming assignments without all-nighters
Published on October 22, 20266 min read
It's Sunday, 10 pm, and the assignment is due at midnight. Two tasks don't work, and you haven't even started the third. If that sounds familiar, the problem is rarely a lack of talent and almost always the process. Here you get a weekly plan for one assignment, a way to break tasks down, and a guide to testing your code before anyone grades it.
Why weekly assignments matter
In most programming courses, weekly assignments, labs or problem sets are not optional extras. How they count differs a lot from course to course. Typical variants:
- They make up a share of your final grade, sometimes a large one.
- You need a minimum score on them to be allowed to sit the final exam.
- Your lowest one or two scores are dropped.
- You have to explain or demo your solution to a teaching assistant in a lab.
- Late submissions lose marks or are not accepted at all.
Which rule applies to you is in the syllabus, the course handbook or on the course page. Read it carefully in the first week. Then work out what you need per assignment. If you know that your two lowest scores are dropped, a bad cold doesn't send you into panic.
Why assignments turn into all-nighters
The all-nighter almost always has the same causes:
- Starting late. The assignment comes out on Monday and gets opened on Saturday.
- The whole task at once. You write 60 lines in one go and then get twelve error messages.
- No testing before you submit. You only find out whether the code works when it is graded.
- Shaky basics. The assignment expects methods with return values or arrays that went by quickly in the lecture.
The same thing helps against all four: small steps, start early, test early.
The weekly plan for one assignment
Spread one assignment over four short sessions instead of one long evening. Each session takes 45 to 90 minutes.
- Day 1, as soon as it is out: read. Read all tasks. Mark terms you aren't sure about. For each task, write one sentence: what goes in, what comes out?
- Day 2: close the gaps. Look up the marked terms. If it is about methods with parameters and return values, read up on them again and solve two small tasks.
- Day 3: write and test. Solve the tasks piece by piece, as described in the next section.
- Day 4, at least one day before the deadline: buffer. Finish the rest, check edge cases, check the submission format. Whatever still doesn't work, take it to office hours or the course forum.
The buffer day is the most important one. It turns panic on Sunday night into a question on Friday that someone can still answer.
Breaking a task down: an example
Say the assignment reads: "Write a method that returns the second largest value of an int array." Instead of typing straight away, break the task down:
- Fix the signature:
static int secondLargest(int[] values). - Clarify what should happen in special cases: duplicate values, negative numbers, an array with only one element. If the assignment doesn't say, ask.
- Describe the idea in words: I go through the array once and keep track of the largest and the second largest value.
- Only then write the code, with test calls in
main.
public class Main { static int secondLargest(int[] values) { int largest = Integer.MIN_VALUE; int second = Integer.MIN_VALUE; for (int value : values) { if (value > largest) { second = largest; largest = value; } else if (value > second && value != largest) { second = value; } } return second; }
public static void main(String[] args) { System.out.println(secondLargest(new int[] {3, 9, 4})); System.out.println(secondLargest(new int[] {9, 3, 4})); System.out.println(secondLargest(new int[] {5, 5, 2})); System.out.println(secondLargest(new int[] {-4, -1, -7})); }}
Output4 4 2 -4
Each test call checks a different case: the largest value in the middle, the largest value first, a duplicate value, only negative numbers. If you are still unsure about arrays and indexes, it pays to walk through cases like these on paper first.
Test it yourself before it gets graded
Many marks are lost not because of wrong ideas but because of forgotten edge cases. Ask yourself these questions before every submission:
- What happens with 0, with negative numbers, with an empty array or an empty string?
- Does every loop work correctly on the first and on the last pass?
- Does the method really return a value instead of just printing it?
- Do the class name, method name and parameters match the specification exactly? Autograders are strict about this.
- Does the file compile without errors, even when you open it fresh?
For tasks with your own classes, add: are all fields set in the constructor? If classes, objects and constructors still give you trouble, that is the section to review before the next assignment.
For error messages, our overview of the most common Java error messages helps.
Getting help without plagiarism
Talking about ideas with classmates is allowed at most universities. Sharing code usually isn't. For AI tools like ChatGPT, the rules differ from course to course. Read your course's academic integrity policy, and if in doubt, follow the stricter reading.
A fair rule of thumb: help that explains an idea to you is usually fine. Help that gives you finished code that you hand in usually isn't. And even if it were allowed: in the exam you sit alone in front of the paper. More on how to use AI sensibly in AI and assignments: avoid plagiarism and still get help.
Where Jario helps
You solve your assignments in your course's environment. Jario doesn't replace them. It does help you strengthen the basics every assignment expects, so that on day 3 you aren't relearning loops and arrays first:
- No setup. The editor runs in your browser. You can practise even when your IDE is acting up on your laptop.
- Feedback before grading. "Check" runs tests, for example "3 of 4 tests passed". You see straight away whether an edge case is missing.
- Errors explained. For compiler errors, a "What does this mean?" hint explains the common messages in plain English, and the tutor's "Explain the error" button explains the error in your own code.
- Hints instead of the solution. The AI tutor knows the task, your code and the test result and gives hints in small steps. You write the code yourself. That is exactly the kind of help that gets you further in the exam.
Tasks are graded from "Easy" through "Medium" to "Hard". If an assignment asks for recursion, for example, solve a few easy tasks on the topic first and then go into the assignment with more confidence.
In short
- Know exactly how assignments count in your course.
- Open every assignment on the day it comes out.
- Break every task down before you write code.
- Test edge cases yourself before you submit.
- Plan a buffer day.
If you are in your first term, our study plan for CS1 goes well with this. You can practise the basics your assignments expect in Jario, task by task, with tests and a tutor who shows you the way but doesn't walk it for you.
Related articles to learn
- Methods and recursionJava methods explained simply: parameters, return, overloading, varargs and recursion with examples. Plus common mistakes like a missing return.Read article
- ArraysJava arrays explained simply: create them, loop through them, use two-dimensional arrays. With examples and common mistakes like the wrong index.Read article
- Classes and objectsJava classes and objects explained simply: fields, constructors, getters, static and records with examples. Plus common mistakes like shadowed fields.Read article
More posts
- Exams and testsAP CSA in 3 weeksAP Computer Science A in 3 weeks: what the exam looks like, a week-by-week Java study plan, and how to write free-response code without an IDE.Read more
- Exams and testsOracle Java certificationOracle Java SE 21 Developer exam 1Z0-830: format, topics, who it is for, how to prepare and whether it is worth it. Plus what changes with Java 25.Read more
- Exams and testsJava exam on paperJava exam on paper: what you need to know by heart, how to write a method step by step without an IDE, and a practice plan that gets you there.Read more