I have an idea - generate working code, make purposeful mistakes (that don’t make code less understandable - errors like using variable created inside loop outside this loop) and let user fix code to make it working.
The code snippet you’re all talking about is a String hashCode right? That doesn’t require a Java compiler to solve. The math is really simple. The only hard part is converting characters to their numerical value using an ASCII table.
Edit: You should never use multiple choice questions to attempt to address automated spam. The idea behind an image CAPTCHA (in absence of OCR) is that an attacker has a 1 in 26^n chance. Even a four character string results in a huge number of possibilities. The problem with multiple choice is that instead of a .0002 percent chance of succeeding, an unintelligent bot (with no informed guesses or web searching) could get in 25% of the time and there’s a relatively high chance that a human could get it wrong, too.
Wt.? You don’t even need to? (At least in java, but its exactly the same in most other languages:)
[icode]
String str = “ABC”;
System.out.println(“ASCII from “” + str + “”:”);
for (int i = 0; i < str.length(); i++) {
System.out.println(( (int) str.charAt(i) ));
}
[/icode]
I agree to your point: The snipped is no protection from spammers. Not at all.
The point was that you did not have a Java compiler you could use. You could go to Wikipedia, solve the first question in 5 seconds, solve the second in 60 by using Wikipedia again and a calculator program, and probably take a short time on the last part, too.
Once spammers solve it once, they can spam and spam until they get IP banned. Then they could go and tell their spammer friends the answer and to go do the same.
I recently did the quiz myself and I have to say I really enjoyed it! It was just a little bit sad that the last question was trivial. About a week ago I learned the Extended Euclidean algorithm at Univerity … :-X
I remember when I was even smaller, I couldn’t register to these forums because I wasn’t experienced enough to solve the various problems I had to solve to register. That part probably saved you all a month or so of newbie questions whose solutions were all readily available on the internet.
Lol, I just used Google to find this page, where everyone was saying the answers out loud…
Don’t get rid of me; I won’t spam, I promise! I’m just very appreciative of many members’ works…
And yes, I could’ve very well just entered that into Eclipse and pushed run, but I was lazy…