views:

214

answers:

3

In the following gcc.gnu.org post, Nathan Myers says that a C++ skills test at SANS Consulting Services contained three errors in nine questions:

Looking around, one of fthe first on-line C++ skills tests I ran across was: http://www.geekinterview.com/question_details/13090

I looked at question 1...

find(int x,int y)
{ return ((x<y)?0:(x-y)):}

call find(a,find(a,b)) use to find (a) maximum of a,b (b) minimum of a,b (c) positive difference of a,b (d) sum of a,b

... immediately wondering why would anyone write anything so obtuse. Getting past the absurdity, I didn't really like any of the answers, immediately eliminating (a) and (b) because you can get back zero (which is neither a nor b) in a variety of circumstances. Sum or difference seemed more likely, except that you could also get zero regardless of the magnitudes of a and b. So... I put Matlab to work (code below) and found: when either a or b is negative you get zero; when b > a you get a; otherwise you get b, so the answer is (b) min(a,b), if a and b are positive, though strictly speaking the answer should be none of the above because there are no range restrictions on either variable. That forces test takers into a dilemma - choose the best available answer and be wrong in 3 of 4 quadrants, or don't answer, leaving the door open to the conclusion that the grader thinks you couldn't figure it out.

The solution for test givers is to fix the test, but in the interim, what's the right course of action for test takers? Complain about the questions?

function z = findfunc(x,y)
   for i=1:length(x)
      if x(i) < y(i)
          z(i) = 0;
      else
          z(i) = x(i) - y(i);
      end
   end
end

function [b,d1,z] = plotstuff()
   k = 50;
   a = [-k:1:k];
   b = (2*k+1) * rand(length(a),1) - k;
   d1 = findfunc(a,b);
   z = findfunc(a,d1);
   plot( a, b, 'r.', a, d1, 'g-', a, z, 'b-');
end
+1  A: 

I had the same issue on a test a few years ago.

The options were A, B, C, or D.

I wrote in option E with my answer and then clearly explained why the other four were wrong.

The test was taken remotely and got a call for an on-site interview the same day.

...you can take it for what it's worth.

Justin Niessner
Makes sense. Point out the error, and if they have a problem with that, you probably wouldn't want to work for them anyway. :)
jalf
+3  A: 

Why are you wasting your time taking tests such as the online one you linked to? That one is so bad that words are not enough to describe the horror.

What you're supposed to do in this case is wash your eyes with soap, get drunk and hope you won't remember anything in the morning...

IVlad
Exactly. And if you're taking this test as part of a job application, decline the job immediately; it sounds absolutely terrible.
ojrac
A: 

I prefer to write notes on the test explaining where the test is invalid. I am also willing to discuss these items with interviewers.

I like to stand by my convictions against horrible code and especially code fragments on tests that are never used or very seldom used in the real world.

Thomas Matthews