# Using questions from a code-competition website in homework and exams

There are various websites like codewars that present programming challenges in various languages and difficulty levels. I looked at some of their challenges and they seem to be more creative than me in making good questions. So, I thought of using this website as a source for exam questions in a programming course I am going to teach next semester.

My plan is to tell the students in advance that some (or all) of the exam questions will come from this website, so that they have the entire semester for practicing. Moreover, I plan to tell them that, if they have any difficulty in solving a challenge, or want any feedback on their solution, they can ask me or the other course staff for help during the semester. My hope is that this will encourage them to practice programming in a competitive and fun environment. Do you think this a good plan? Do you have experience using such websites in programming courses?

## 3 Answers

Whether this is a good plan or not depends on some things, most especially the nature of your students.

However, it seems a bit too unstructured. If you have a general mix of student ability it could cause problems unless you incorporate the questions from the site(s) more formally into your teaching. There are a lot of questions available, I would guess and some of your students will panic, thinking that (a) they need to do everything or (b) it is hopeless. This is a special problem if these extra questions are above and beyond all necessary assigned work.

However, one good aspect of your plan is to show them in advance the kinds of things that they will be expected to know and that other students also regularly deal with. Much better that than hiding your intent and springing things on them unexpectedly.

But I think a better plan is for you to incorporate a sampling of the found questions into your labs and homework assignments. For the most challenging questions you could have five minute brainstorming sessions as part of several class periods.

In short, as part of the regular process it should work out, but if it is completely "extra but not formally rewarded" work it might backfire on you.

An additional dimension here, of course, is that you could use the site(s) to teach yourself how to ask better questions. And your focus on "creative questions" rather than necessarily "challenging questions" is a good one, I think.

• +1 for the last para. Especially if OP's course teaches "don't just copy/paste answers from code sites (like SO) when doing homework". Jan 22, 2018 at 7:43

I have done something similar to this. I've found codingbat to be a great resource. The exercises there are not complex and are structured in a way that later exercises build on previous ones. There are more exercises there for Java than Python but at worst it may be useful for prompting ideas.

Now, I have set classroom exercises using some of the ones here, not least because it shows them the tests that are run on the code and I would hope- gets them thinking about test cases, boundaries and so on. Even though I had stated in previous years that some exam questions would be sourced from the site, I have been disappointed to see very few actually engage with the exercises.

Last year I used replit for the first time. Rather than use codingbat for code challenges, I was inspired to create my own version of it where I could actually "see" what people in the class were coding, and I could write my own tests to test their code. I have found this to be extremely useful, and each evening I can review their code submissions, offer suggestions, see where they are having problems- syntax, logic, indentation (python), incorrect docstrings and so on.

These are the codingbat-style exercises I wrote and posted. I can also set up tests that they can run and see what cases fail.

Once a learner views a lab, it forks a copy for them and I can see the clock icon. If they submit it, I will see an hourglass icon and how many tests were passed and then I review the file for things that unit test will not catch- tidyness and so on. Once I have reviewed and accept the submission, it appears with a tick mark icon.

Admittedly it is more work than using something that it "there", but I can jump into their repls and join them in coding, or observe them coding, add comments or chat in real time. If we have to do remote work again this will be really useful, but even in class I find it useful as I do a "walk-through" akin to strolling around the room to see where each learner is at. I am pretty impressed by what is available on this platform.

There are lots of videos that show how to use it- here is just one that I found useful.

Overview of using Teams for Edu

• Thanks for the links for these interesting resources! Oct 17, 2021 at 17:48
• @ErelSegal-Halevi the repl Teams for Edu are now FREE. I paid when I joined as it was worth it for me to have those features. May 7 at 15:21

Those problems are usually more in the line of 2 hour work to get it done, so I'd either sample very carefully and/or simplify. For on-line exams the format of an input in a fixed format, no validation needed, and a fixed output is nice (can be graded by test cases). You'll want to add a code review. A generic rubric of mine for programs ran roughly like:

• 50% Running
• 15% Test cases given with the problem
• 35% Unpublished test cases
• 50% Code quality
• 5% Compíles without warnings
• 10% Code organization (decent variable/function names, comments, consistent indentation, ...)
• 20% Use of the language facilities (use switch/if, loops, ...)
• 15% Use of library facilities that are appropriate, external tooling (Makefile or such)

Obviously you'd adjust according if needed to tailor to particular problems. But tell them beforehand that this will be the rough grading scheme.

You could asign some of the problems as homework, with a similar grading idea. But check first, I've seen problems misclassified as to best/recommended solution strategy, some very hard problems are said to be "medium", and sometimes the posed problem is just impossible to understand (looks nice at first glance, though). And check that solutions aren't available (some miscreants publish their solutions on github).