After learning recursion in class, students take a test (a few lessons for teaching the subject, and then a test), and are then given a grade. The test is on paper, and I can't change that fact.
All tests are written on paper, but the questions on the test are subject to changes, and those are the changes being asked about.
These students are in a CS major in High School.
Besides asking them to write recursive functions for a variety of purposes (tree traversal\search etc.), their knowledge is also tested by asking them to trace by hand (on paper, without a computer) a given recursive function (usually one that does string manipulations).
For example:
public static int permutation(String prefix, String str){
int n = str.length();
if (n == 0) {
System.out.println(prefix);
return 1;
}
else {
int sum=0;
for (int i = 0; i < n; i++)
sum+=permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n));
return sum;
}
}
and it is called in some main
:
public static void main(String[] args) {
System.out.println(permutation("", "abcde"));
}
This is an example for how their tracing should look like (this image is not related to the permutation example above, but it serves to explain how they trace the recursion)
They essentially trace the call stack (and they know this; they know that effectively that's what they are doing).
However, I have some doubts about this method of testing (specifically the tracing).
So, would testing students like this be useful? By that I mean: does it actually indicate understanding of recursion and\or increase their ability to understand recursive functions they see?
If not, then how else can their knowledge of recursion be tested in a written test?
The tests are given because that's how the students are taught:
- They study a subject (in this case, recursion)
- they are tested on that subject.
There's no bigger goal, no project that they use it in (yet). They learn it because it's part of the curriculum.
Clarification
My question isn't about teaching recursion, nor is it about the specific example I gave. It's about whether the described test method (on an exam) would actually be able to test the students' knowledge about recursion.