I'm a sophomore CS Major, and I have a final programming project due on Monday for one of my classes, but right now, I've been stuck on it for the past two days. I've tried several different approaches to finding the problem with my code, but I can't get it, and I can't ask for help from anyone (including TAs/the professor) since it counts as an exam. Should I just give up on it and submit what I have at the moment? It's really frustrating and stressing me out, and I have another final to study for.

  • 3
    Debugging is one thing, not understanding how to solve the problem is another, and it's not clear which it is for you yet. But to "Should I give up?" the answer is probably "No, but put it aside since you're stuck, study for the other final for a day to make progress there, then come back and try something different." Break the problem into smaller problems/steps, add print statements for intermediate results, etc.
    – uhoh
    Dec 17, 2022 at 4:43
  • 1
    I'm trying to debug at the moment
    – Gift G.
    Dec 17, 2022 at 4:50
  • 3
    There is one person you can ask: your professor. At worst, they will tell you they can't answer the question. But there's a chance that they can provide some answer that might help: maybe the problem hasn't been worded clearly, or maybe they can suggest that you document any assumption you can make that will "unstuck" you. (You may not have a correct answer, but often there is partial credit available for correctly pursuing an incorrect approach.)
    – chepner
    Dec 17, 2022 at 14:38
  • Following up on @chepner's comment, you might try asking for some (nontrivial) hints that would allow you to make further progress, at the expense of some automatically deducted points. This is something I often did as a teacher (e.g. see this answer) to my own advantage, as explained in the last sentence of that cited answer. Dec 18, 2022 at 18:23

5 Answers 5


You're going to have to make the decision. I'll only point out that this is not dissimilar to another situation which you've surely encountered before.

Consider: you have 30 minutes left in an exam, and you're stuck on one question which you've spend 10 minutes on without progress. You could give up and move to another question which you've yet to look at, or you could keep working on it. What do you do?

Ultimately you need to do whatever maximizes your grade. If you keep working on this assignment, how many points are you likely to gain? If you give up and work on the other exam, how many more points are you likely to gain? If you give up, are you likely to still pass? How important is it for you to pass anyway (e.g. if it's a core course and you fail could your graduation be delayed by a semester)? You know your circumstances better than anyone else, so you will need to make the decision; nobody else can do it for you.

  • 3
    It is sad that 'ultimately you need to do whatever maximizes your grade'
    – FShrike
    Dec 17, 2022 at 16:40
  • 9
    @FShrike - I'd actually regard this as pretty good training for doing programming - pragmatic assessment of what goals are achievable in the time is an excellent skill to learn
    – lupe
    Dec 17, 2022 at 17:58

In my view, the crux of your dilemma is contained in the final context statement ("... I have another final to study for") rather than in the simple question about whether to give up on an assignment or not.

For example, if your current focus is on an assignment for an elective that is not critical to your overall success, it would be obvious that you should change tack. You might also consider how likely you are to pass the other exam without further study, and how necessary (or not) it is for you to get something higher than a mere pass.

Whether for good or ill, a lot of university study involves trade-offs of the kind that are sometimes referred to as exploitation vs exploration. Do you invest more time in the problem you are currently working on, or do you explore other options (studying for other forthcoming examinations) in the hope that the effort you invest there might be better rewarded than in your current focus? Unfortunately, only you can answer ... but it is worth explicitly thinking about:

  • your own estimate of the probability of you solving the assignment you're working on, as well as your estimate of the likely value (mark) that you'll receive
  • your estimate of the probability of you successfully studying for the other upcoming exam, and of the mark you might achieve
  • and finally, the relative value of the two different assignments/exams.

Let me suggest, first, that not all projects are successful, nor all approaches productive. You also have a fairly firm (hard?) deadline to produce something.

Rather than giving up on the project and not submitting anything, I suggest that you write up what you have done and where you are blocked.

Most important, include your best analysis about the nature of the block as you see it. What is it about the problem that creates a gate that you can't open? What thinking process led you to the current state.

Personal note: I once passed a comprehensive doctoral oral exam with flying colors, responding in just this way to the examiners. "I'm blocked, sorry, and this is why...". I was later actually praised for that response, since it showed some insight, though no solution.


and I can't ask for help from anyone (including TAs/the professor) since it counts as an exam.

That's not a reason not to ask for help. They may not give you exactly what you ask for, but they may offer some kind of help - hopefully the kind which, if you've followed the course material properly, will indeed put you back on track.

Should I just give up on it and submit what I have at the moment? It's really frustrating and stressing me out, and I have another final to study for.

First, consider asking for an extension due to the conflicting final - and if refused, perhaps even an extension with a grade decrease. Better that than just "bombing" the assignment.

Second, consider asking for some alternative form of evaluation given the circumstances.

A third option: In some universities, the final exams in courses are given twice - in two sessions with a different exam for each - where the student can choose to take only one, or both, but with the second session's score always replacing the first session's. Perhaps something like that can be arranged with this course of yours? e.g. delaying the evaluation (and your grade) until the end of the next semester, taking the final assignment with them?

A fourth option: If the course staff refuses everything, consider consulting a colleague who's also taking the assignment, and whom you know has completed it or has fully worked out what is to be done. Tell them you're completely stuck, and ask for some guidance. Guidance, of course, is not the same as access to your colleagues solution - but something to help you become unstuck. This final option may get into some ethically-gray territory and also depends on the social and formal conventions of this kind of assignment-taking at your institution, so take this suggestion with a grain of salt.


Does it compile?

If code doesn't even compile, generally you'll fail a programming assignment. So at least get to that point. If that's your problem, you have plenty of compiler error messages to tell you what you've done wrong, and Google has more info on fixing them.

Does it run at all?

If it crashes at some point during running, stop the code at a random point and see if it gets there. If it crashes before that, stop at a point before that and try again, until you find a point where execution gets there. After that, work forward until you find where it's crashing.

Note that running in a debugger will make this easier. The debugger will give you a stack trace telling you what function it crashed in, and the nested function calls which led up to that crash.

Once you're past these two steps, you're into the possibility of a "gentleman's C". In which case document your known failure - what the inputs are, and what outputs you're getting versus what outputs you're expecting. This demonstrates you know good practice for debugging, and that you've isolated what's going wrong. It also points the assessor at where they'll likely check for the bug and how to check what's right versus what's wrong.

And not infrequently, the process of writing this down might trigger a spark of realising what you've done wrong. :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .