News for hackers. Stuff that matters.
Re:Show HN: 15-question programming quiz with answers by bussierem on Tuesday May 23, 2017 @01:17PM (#14403062)
Hey, not the GP, but just glancing through the quiz - Question 3 focuses on the fact that Python passes things by reference to functions. This is definitely specific to the two languages you guys use (as is your prerogative), but if you're expanding this for others, you should definitely explain that these focus on the JS and Python languages.
Re:Show HN: 15-question programming quiz with answers by rodovich on Tuesday May 23, 2017 @01:36PM (#14403237)
Additionally, question 2 amounts to "what is the usage of python's queue class", question 4 requires knowing whether array indexes start at 0 or 1 in python, and question 8 amounts to "what is the usage of python's bytearray class".
Re:Show HN: 15-question programming quiz with answers by philh on Tuesday May 23, 2017 @06:32PM (#14405980)
I'm not sure that's fair about question 2. It's hard to say because I know python (but not the deque class), but none of the incorrect answers seem like they'd be correct in any sensible language.

Like, whatever language you're using, you need to push the children of the current node on to the queue. Only one answer looks like it could reasonably do that.

Re:Show HN: 15-question programming quiz with answers by Bartweiss on Tuesday May 23, 2017 @07:17PM (#14406289)
Yeah, agreed. Question 2 as asked demanded Python knowledge, but once you checked against the answers provided it seemed much clearer that 3 options were invalid.
Re:Show HN: 15-question programming quiz with answers by freyr on Tuesday May 23, 2017 @02:23PM (#14403780)
Also, strictly speaking, Python is not "pass by reference" as the term is used for other languages. It's more accurately "pass by object" or "pass by object reference." Somewhat of a pedantic distinction, and the quiz question is clear regardless.

[1] http://robertheaton.com/2014/02/09/pythons-pass-by-object-re...

[2] http://foobarnbaz.com/2012/07/08/understanding-python-variab...

[3] https://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-...

Re:Show HN: 15-question programming quiz with answers by ammon on Tuesday May 23, 2017 @01:25PM (#14403130)
Good point. I think that objects are passed by reference in a high enough % of language in common use (PHP and C++ are the two exceptions I can think of) that this is a fair question. But if enough people think it's bad, we'll remove it.
Re:Show HN: 15-question programming quiz with answers by marcosdumay on Tuesday May 23, 2017 @02:19PM (#14403738)
You got me on that too. A high enough % of the languages pass stuff by value (C/C++), copy on assignment (C++, D, I'm sure there are more), or do not have the concept of references or changes to start with (Prolog, Haskell).

Anyway, if you want to bias it into Python, go for it. It's a fun quiz.

Re:Show HN: 15-question programming quiz with answers by Bartweiss on Tuesday May 23, 2017 @07:18PM (#14406297)
Copy on assignment was what got me, and I didn't feel terribly bad for missing it. No harm done though, seeing as nothing was riding on the quiz.
Re:Show HN: 15-question programming quiz with answers by macintux on Tuesday May 23, 2017 @02:07PM (#14403614)
Every functional programmer in the world is looking at you askance.