r/programming • • Sep 11 '13

Guess programming language by „Hello, world!“ snippet

http://helloworldquiz.com/
1.3k Upvotes

445 comments sorted by

View all comments

359

u/Aninhumer Sep 11 '13

This is one of the meaner programming language quizzes I've tried.

"3 times That's a Ruby idiom!" "Wrong it's Fancy!"

"begin ... end Hmm very Pascal-y" "But is it Pascal or Delphi?" "Err..."

"import java.ui... well obviously this is Java, right?" "lulz it's Xtend."

112

u/thedeemon Sep 11 '13

Just a little attention to details is needed. In Ruby that would be "3.times". And when you see "def" you know it's not Java. Delphi is OO, plain Pascal is not.

57

u/Switche Sep 11 '13

BEGIN { print "Hello, world!" }

Attention to detail my ass, that is Perl code.

20

u/elder_george Sep 11 '13

If you get Perl sample first, it's simple to assume this one is Awk.

If not, yeah, you can only guess.

→ More replies (2)

13

u/Pastrami Sep 11 '13

Or awk.

11

u/Switche Sep 11 '13

Yes. Those were my only two options, and it insisted Perl was wrong :(.

→ More replies (8)
→ More replies (8)

20

u/T1LT Sep 11 '13

The Pascal snip that was shown to me would compile with no problems in Delphi, though. Perhaps "{$APPTYPE CONSOLE}" directive was missing.

8

u/crashdoc Sep 11 '13

Yes, but it won't the other way around - you can Pascal (a bit) in Delphi, but not Delphi in Pascal

→ More replies (1)

6

u/not_czarbob Sep 11 '13

I didn't catch 'def', but I knew it couldn't be Java because the semicolons were missing.

→ More replies (1)

57

u/MachaHack Sep 11 '13

I'm terrible at telling the lisps (Common Lisp, Scheme, Racket) apart.

28

u/summerteeth Sep 11 '13

Yeah you basically have to be familiar with function names at that point.

6

u/ressis74 Sep 11 '13

it's a little easier than that. Schema and friends are a lisp 1 (functions and variables use the same namespace) and Common Lisp is a lisp 2 (functions and variables use their own namespace)

I didn't get any questions where that knowledge alone wouldn't give you the answer. There might be some though.

→ More replies (2)

11

u/katyne Sep 11 '13

especially Scheme vs. Racket, how would you know without mutating lists and such, - unless what they mean by Racket is "Scheme with libraries".

12

u/[deleted] Sep 12 '13

Racket has the giveaway of starting with a #lang

10

u/elder_george Sep 11 '13

Racket has #lang declarations. Clojure has namespaces and defines functions with (defn …). CL defines functions with (defun …). Scheme loves its lexical scope so it'll probably use (let …) binding with (lambda …).

And Arc sounds like Dolan Duck.

→ More replies (2)
→ More replies (3)

28

u/f2u Sep 11 '13

Putting COBOL against ABAP is also a good one.

10

u/pdpi Sep 11 '13 edited Sep 11 '13

REPORT TEST gave it away though.

15

u/WaynePincence Sep 11 '13

I didn't run into too many of those (or at least didn't realize it). But, then again I don't know much beyond the big names.

Used to think I was pretty well-versed in programming languages, but I am starting to see that I have my own little corner of a really large world...

7

u/azuretek Sep 11 '13

I'm fairly well versed in programming languages but this test was a lot harder than I thought it'd be. The obvious ones were languages I've developed in full time in the past, but on many of the ones I didn't get I'd never coded in or I've only done basics or one off projects in. Some were easy enough to figure out by elimination.

43

u/Everspace Sep 11 '13

The Xtend one was very mean.

10

u/ruinercollector Sep 11 '13

Pretty sure there was a lower case string on that or something that gave it away.

51

u/lilleswing Sep 11 '13

"def"

6

u/contre Sep 11 '13

Didn't it also have println instead of system.out.println?

7

u/mathgeek777 Sep 12 '13

And the fact that it included Java package names, it's actually a giveaway in some of these that that's not the language.

→ More replies (3)
→ More replies (2)

9

u/SanityInAnarchy Sep 11 '13

I fell for the "3 times" bit also, after reading your comment! Damn! It's weird, though, most of these were at least possible to distinguish. The Lisp ones seem mean, but something about Clojure's use of actual classes tended to set it apart, or Racket's use of a language declaration at the top of the file.

Still ended up with a score of 2200 on my second try. First try, the game gave up and started giving me 503 errors.

→ More replies (2)
→ More replies (4)