An attempt at a short no-prerequisite test for programming inclination

There has been previous discussion on LW on the topic of how to quickly determine if someone might be good at programming. This is relevant because this is currently a good career field that can be relatively easy to enter, and because programming-style thinking is often relevant to LW topics (eg decision theory). In light of this I've created the following test, which is based on my memory of a test from an interview process for a programming job. It attempts to test common low-level concepts from programming such as sequence, assignment, indirection, and recursion, in a way that doesn't require any previous programming experience (although previous experience will likely make it easier).

This test is aimed at getting a quick clear positive, so the fact that someone does poorly on it doesn't mean they can't become a programmer (ie I'd guess it's likely to generate false negatives rather than false positives). This test is obviously lacking scientific validation, and is probably too short, but I'd like to start somewhere.

I'd like to invite both programmers and non-programmers to take the test for comparison. It should only take about 5 minutes. If you do the test, please also take the short poll in the comments for feedback and calibration purposes, regardless of what result you got.

-----  Test begins below  -----

This is a 1-question algorithmic thinking exercise that should take less than 5 minutes.

Pen and paper is required. There should be no prerequisites beyond basic arithmetic.

First, write down the following sequence of numbered boxes. You will be writing numbers in some of the boxes more than once, so either use a pencil or make the boxes big enough to cross out and replace numbers.

    1    2    3    4    5    6    7    8

   [  ] [  ] [  ] [  ] [  ] [  ] [  ] [  ]

Following is a sequence of numbered steps. Do the steps in the order they are numbered (unless instructed otherwise). Note that "write a number in a box" means "cross out the previous number and write the new number".

1. Write 1 in box 3, 2 in box 6, 9 in box 4, 1 in box 5, 5 in box 8, and 0 in the remaining boxes.

2. In box 4, write the sum of the number in box 3 and the number in box 5.

3. In both boxes 2 and 5, write the the number in box 8 minus the number in box 6

4. Write 1 in the box whose number is in box 3

5. In box 3, write the sum of the number in box 3 and the number in box 4

6. In the box whose number is in box 6, write the sum of the number that's in the box whose number is in box 4, and the number that's in box 5.

7. Do step 2 again, then continue directly on to step 8.

8. Do step 4 again, but this time with box 4 instead of box 3, then continue directly to step 9.

9. The final result is the number that is in the box whose number is the number that is in the box whose number is equal to 2 plus the number that is in box 4. End of test.

--------------

Expected Results: http://pastebin.com/wA6xDxVb

Thanks for taking the test! Don't forget to answer the poll in the comments too.

I'd also appreciate any feedback on the test, both if you think its going in the right direction or not and if you think there are specific improvements that could be made.

edit: As some commenters have pointed out, there was a previous attempt at such a test that you may have heard of: http://www.eis.mdx.ac.uk/research/PhDArea/saeed/

However, it seems that further investigation found that their test, while better than nothing, wasn't very accurate. The test given in this post takes a different approach.

Comments

sorted by
magical algorithm
Highlighting new comments since Today at 2:48 AM
Select new highlight date
Rendering 50/68 comments  show more

I'm a programmer and unlikely to actually do this test because it strikes me as pointless and boring. Possibly I'm atypical, but consider censorship bias nonetheless.

I'm in the "experienced programmer" category. I answered the question correctly and quickly (and without inventing special notations for those repeated indirections). I found it unpleasant -- it reminded me of this "literacy test". Even if this turns out to be effective in predicting who will make a good programmer, I'd hesitate to use it for that purpose, for fear of putting people off unnecessarily.

Well, there's a big difference here in that "failing" the test doesn't prevent anyone from doing anything. The idea is more to encourage people who seem to find this sort of thing natural.

I'm forced to remind myself that that test was not actually designed to be a literacy test.

It includes riddles/illusions (Paris in the the spring for example), irrelevant terminology ("bisect"?) and unnecessary arbitrary things like knowing the order of the letters in the alphabet. If you became literate chiefly by reading...

Correct. Not an actual literacy test but a tool of oppression. (For a less blatant example at a much higher level, see "Jewish problems".)

I suggest that the history of this sort of thing is part of why the response to "hey, it turns out black people do worse than white people on IQ tests" is often to suggest that there's something very, very wrong with the tests. I mention this only because it's a topic that comes up every now and then on LW.

[EDITED to add: I should reiterate that I'm not suggesting any such sinister motive in the present case!]

It includes riddles/illusions ([redacted] for example)

You might want to rot13 that, in case people are considering taking the test themselves.

unnecessary arbitrary things like knowing the order of the letters in the alphabet

I wouldn't consider that that unnecessary and arbitrary -- I guess most people in jobs requiring literacy need to sort a list alphabetically or look something up in an alphabetic list at some point in their life, especially back then before electronic computers.

Okay fair, that makes sense. But then, why not have the test just say "write down the letters of the alphabet, in order", rather than being tricky. Plenty of very literate people still need to sing the mnemonic song in order to recall the order.

Oh wait, no, the being tricky is testing to see if people are literate enough to understand the fiddly details of the question. Still, I'd say testing that separately from alphabet skills is more efficient etc.

Wow.. that literacy test is something else. I would have thought they would have been slightly more circumspect about the fact that this was just a way of disenfranchising black voters. But no, instead they come up with a test that is obviously just designed to be a giant "Fuck you, nigger". It's not just that the test is unreasonably hard, it's that the questions -- plus the absurdly strict grading criteria -- look like there were specifically chosen to signal unreasonable hardness (if that makes sense).

St. Rev on twitter believes that the test is likely a hoax due to the way to was formatted vs. other tests at the time. There was still likely some test that was aimed at disenfranchisement but given the lack of evidence that it was real I'd say he might be right about this particularly unbelievable one one being a fake.

Maybe it's a hoax, but I'm not sure the formatting proves that. The website itself mentions that the version of the test posted there is a "word-processed transcript of an original". The original is here. Was this guy referring to the original or the transcript when he made his point about formatting?

I forget the name, but when performing tests there's a desire to capture all of the relevant information and no irrelevant information. It's sort of like false positives vs false negatives, but I think what I'm really trying to get at is the idea that unless a test produces entirely random results, it's ultimately sorting people somehow. The question is "how much does that 'how' relate to programming potential?"

In the case of this test, I'd say it probably has a weak correlation with programming ability, and a stronger one for general reasoning ability.

I think this test is kind of backwards: it figures out if you can follow instructions, not if you can take a process you understand and turn it into instructions (i.e. an algorithm). Although I suppose the following-instructions part is a necessary prereq for the creation part. At the very least, I think you'll want to test the algorithm creation skill too. Then, if following is a prereq, you don't need to bother testing for it any more, as anyone who would have failed there will also be screened by the creation step.

(I'm a professional software engineer, sometimes)

Non-programmer, but have tried a little programming. Weirdly, I got the final answer right on the first pass, but the numbers in the boxes had some mistakes. I got the boxes right on a second pass.

It seems like a fair test of certain kinds of mental focus.

Whose, not who's.

You're asking people to execute a program, but you should be asking people to write a program.

Concretely, I have seen this style of test (for want of better terms, natural language code emulation) used as a screening test by firms looking to find non-CS undergraduates who would be well suited to develop code.

In as much as this test targets indirection, it is comparatively easy to write tests which target data driven flow control or understanding state machines. In such a case you read from a fixed sequence and emit a string of outputs. For a plausible improvement, get the user to log the full sequence of writes, so that you can see on which instruction things go wrong.

There also seem to be aspects of coding which are not simply being technically careful about the formal function of code. The most salient to me would be taking an informally specified natural language problem and reducing it to operations one can actually do. Algorithmic / architectural thinking seems at least as rare as fastidiousness about code.

This test doesn't seem too different from a US income tax form. Most people are able to complete US income tax forms correctly, so I wouldn't expect completing this test correctly to be strong evidence of programming inclinations.

An attempt at a short no-prerequisite test for programming inclination

Somebody else beat you to it and wrote papers about it. Maybe more than one somebody, but that's all I'm digging up for you.

See the discussion: http://www.codinghorror.com/blog/2006/07/separating-programming-sheep-from-non-programming-goats.html

Multiple papers on the topic are here: http://www.eis.mdx.ac.uk/research/PhDArea/saeed/

From the main page:

We (Saeed Dehnadi, Richard Bornat) have discovered a test which divides programming sheep from non-programming goats. This test predicts ability to program with very high accuracy before the subjects have ever seen a program or a programming language.

Draft paper which incorporates some of the criticism we got at Coventry mini-PPIG and the University of Kent in January 2006.

Abstract: All teachers of programming find that their results display a 'double hump'. It is as if there are two populations: those who can, and those who cannot, each with its own independent bell curve. Almost all research into programming teaching and learning have concentrated on teaching: change the language, change the application area, use an IDE and work on motivation. None of it works, and the double hump persists. We have a test which picks out the population that can program, before the course begins. We can pick apart the double hump. You probably don't believe this, but you will after you hear the talk. We don't know exactly how/why it works, but we have some good theories.

Now let's do some reductionism magic. Taboo "programming skills".

Which skill specifically is the one that some students have, and other students cannot be taught? If there are more skills like that, which is the most simple of them?

(If all we have is "here is a black box, we put students in, they come out in two groups", then it is not obvious whether we speak about properties of the students, or properties of the black box. Why not say: "Our teaching style of programming has a 'double hump'." instead?)

This is what I'm reacting to. IIRC some a follow-up study showed their proposed test didn't work that well as a predictor, so this is a different angle on the problem.

My first instinct was to link to codinghorror as well, so I think it would (have) be(en) helpful to include the "what I'm reacting to" in your initial post.

Reading a little further ...

We now report that after six experiments, involving more than 500 students at six institutions in three countries, the predictive effect of our test has failed to live up to that early promise.

And reading a little further than that...

The test does not very accurately predict levels of performance, but by combining the result of six replications of the experiment, five in UK and one in Australia. We show that consistency does have a strong e ffect on success in early learning to program but background programming experience, on the other hand, has little or no effect.

I've read about some test someone developed that was supposed to work fairly well. You give a list of short psudocode problems and ask what values different variables have at the end. If they answer consistently, even if it's not what any actual programming language uses, they'll be able to program. If they answer inconsistently or refuse to answer (because x = x+1 is impossible), then they probably won't be a very good programmer.

I think you're referring to the test mentioned here.

That is sort of what this is referring to - apparently that test didn't work very well when they tried it more widely, so this is approaching the same problem from a different angle.

Silly me! I had the array exactly right but the result was wrong. I used the second box to find the value that I eventually added the value of box 4 to and got 7.

Poll for test takers:

Programming experience vs. whether you got the correct results (Here "experienced" means "professional or heavy user of programming" and "moderate" means "occasional user of programming"): [pollid:528]

Did you think this was fair as a quick test? [pollid:529]

I got this right, but ended up having to invent notation to keep track of the indirection in the last segment. I think it's likely a decent test of whether you're likely to quickly pick up an intuitive head for pointer math and a very basic variable name-value distinction, but it won't capture other forms of abstraction that're necessary for programming: loops, types, conditional branching, Boolean logic. You could probably get away with dropping conditionals (I get the impression they're fairly intuitive), but I've had trouble teaching the others in the past.

Has a bit of an old-school feel to it, too; I'd expect the results to correlate better with talent for C than they would with, say, Python.

I'm a new user with -1 karma who therefore can't vote, so I'll combat censorship bias like this:

Moderate programmer, correct

Yes

So, as of 2013-06-30 20:42 (UK summer time) it's 13:4 for "experienced programmers", 10:2 for "moderate programmers", and 7:2 for "non-programmers". The "moderate programmers" are beating the "experienced", and the "non-" are well within the margin of error.

Now, of course LW is a hive of scum and villainy^H^H^H^H^Hplace where even the non-programmers tend to be pretty programmery, and as Morendil points out the people who chose to take the test may be atypical somehow -- but, still, this looks to me like evidence that this isn't a very effective test for discriminating between people with aptitude for programming and people without.

I see an alternative interpretation for the last question: The final result is (the number that is in the box whose number is the number that is in the box whose number is equal to 2) plus the number that is in box 4. (Might also be good to make a sharper distinction between the indices of the boxes and their contents.)

Coincidentally, there is another current attempt to use a LW poll to determine whether a simple test is useful for predicting success at programming-like jobs. Basically, it just asks you at what age you learned to touch type.