I was curious after reading this, so I Googled sample questions from the AP Computer Science exam.<p><a href="https://www.tracy.k12.ca.us/sites/clunetta/Java/practice/practice.htm" rel="nofollow">https://www.tracy.k12.ca.us/sites/clunetta/Java/practice/pra...</a><p>The last question on the test is this:<p>The method mixup is defined as follows:
String mixup(String word)
{
if (word.length() == 1)
return "";
else
return mixup(word.substring(0, word.length() - 1))
+ word.charAt(word.length() - 1);
}<p>What is the value of the string returned by mixup("IDEAL")?<p>a) IDEAL
b) IDEA
c) LEAD
d) LEDA
e) DEAL<p>I don't program much in Java, so maybe I'm missing some gotcha, but shouldn't the answer to this be "L"?
The recursive mixup call will go: IDEA... IDE... ID.. I, at which point the final return value will be "".<p>So the value of the returned string will be "" + "L" therefore returning "L"?<p>In any case, the point of looking at this was to get some sense of whether a kid would even want to take AP Comp Sci. My concern with this, knowing how most of these subjects get taught in school, is that teachers would teach to the test, therefore sapping all of the fun out of programming. Knowing some of this stuff by heart is potentially valuable I suppose, but kind of operates in a vacuum, as practically you have a ton of resources at your disposal when programming (ie Google, Stack Overflow, API references, etc). This rote memorization of things could actually turn kids off of computer science instead of drawing them in.