An AP Computer Science Problem

An AP Computer Science question my 16-year old son was given recently…I was curious if anyone had the same reaction that I had to the “answer”.

So, this was a question Brian was given in a recent AP Computer Science class. The answers he was asked to choose from were:

A. Reorders the array from smallest to largest value

B. Reorders the array from largest to smallest value

C. Finds duplicate values in an array

D. Accesses all consecutive pairs of elements

It is clear that A and B are decidedly not the answer. So, C and D are the only viable answers remaining. And I know I’m going to knit-pick here, but honestly, words matter. And they matter here, especially when you’re talking about questions that have multiple potentially-correct answers.

Brian chose D on this one, and it was counted as wrong. (C was the official answer.) Technically speaking, he’s right. This code snippet does access all consecutive pairs of elements. You can’t tell me it doesn’t. Having said that, it does (also) find duplicate values in the array. So, why is he wrong?

I believe this ultimately comes down to the question of choosing the best answer, not always the technically correct answer. C is the best answer (of the potential answers presented) to this question. To see why, we have to go back to the question:

“What does the following code snippet check for?”

Accessing anything (duplicate values or not) is not checking for anything. It’s just accessing. That alone renders D not the best answer. Hence, C, while it doesn’t describe what the snippet is actually doing, is the only answer left.

The code snippet actually validates the existence of at least one duplicate pair of values in the array. That is the technically correct answer. But that answer was not presented. And this is the lesson we had to reiterate to Brian. On these standardized tests (AP, SAT, ACT, whatever), always look for the best answer to a question.

Op-Ed: I really don’t like standardized tests. And this is one of the reasons. They are trick questions, so to speak. And to expect teenagers to read it, recognize it as such, and formulate that assessment in less than 60 seconds is ludacris to me. Computer Science is hard enough. Trick questions are NOT needed to make this difficult.

P.S. In real life, no one ever asks you this type of question.

Lee Feagin @leefeagin